Git Product home page Git Product logo

golangcookbook.github.io's Introduction

Go Cookbook

Source for the Go Cookbook, a community build and contributed collection of practical recipes for real world Golang development, supported by SuperOrbital.

Contributing

The Go Cookbook is supported by SuperOrbital, but built by the community, so your contributions are very welcome. Just send a pull request for any changes or additions.

Adding a New Recipe

Recipes are generated from the _data/chapters.yml file, which is used to build the index page. The chapters.yml file format is:

- title: Strings
  recipes:
  - title: Concatenating Strings
    path: /chapters/strings/concatenation
    wip: true
  - title: Detecting a Substring
    path: /chapters/strings/detecting
  - title: Detecting All Substrings
    path: false

Specifying wip: true puts "[Work in progress]" in front of the recipe in the index. Setting path: false causes the recipe to be listed without a link.

Recipe Format

Recipe files have a couple of required properties, specified in the preamble like such:

---
title: Processing a String One Word or Character at a Time
question: Given a string, how do I break it into words or characters and process each one in turn?
---

Also, to show example code, recipes can make use of the {% include example.html example="filename" %} helper. This will include both filename.go as example source code, and filename.expected.escaped as the output of that code. If you're curious, here's the definition for that helper. The filename.expected.escaped files are automatically generated by the ./run_tests script, described below.

Run locally

This project uses Docker for local development. Once you have Docker installed:

$ ./run server
$ open http://localhost:4000

Run the tests

$ ./run tests

The run_tests script not only runs the tests, but also ensures that the .expected, .go.escaped, and .expected.escaped files are in place. These files are then used in the recipe templates to ensure all examples are up to date and correct.

License

Creative Commons License

The Go Cookbook copyright SuperOrbital, and is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

golangcookbook.github.io's People

Contributors

tammersaleh avatar ericdgreene avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.