Skip to content

psampaz/gophersnippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gophersnippets is a collection of code snippets with tests and testable examples for the Go programming language.

Each snippet:

  • is small and shows how to achieve something specific with Go
  • contains at least one test or testable example
  • runs on Go playground since it now supports tests and testable examples

Snippets

Conversions

HTTP

Interfaces

Logging

Maps

Numbers

Other

Parser

Runtime

Slices

Strings

Testing

Time

Comments

https://gophersnippets.com uses Github issues for comments, powered by https://utteranc.es/. You can add comments directly on the corresponding Github issue or use the comment form under each code section.

Contributing

You are welcome to contribute testable Go code snippets.

Please read the following before submitting a PR:

Guidelines:

  • Include only one code snippet per PR
  • The snippet should be small and solve one problem only
  • Include comments when necessary
  • When you submit a PR the following checks will run automatically:
    • code includes at least 1 test or testable example

    • code runs successfully on play.golang.org

    • code passes go vet

    • code includes a category and a title in the first line of the code (Category: Title)

      // Strings: How to reverse a string
      // package main

      or includes a category and title in the first line of the code, an empty comment line and then a description

      // Strings: How to reverse a string
      //
      // Description
      // package main
    • code should be included in one file only, named main_test.go. This is necessary in order to test and run snippets locally

    • folder should match the slug version of the title:

      if the title is How to reverse a string,

      the folder should be snippets/how-to-reverse-a-string

      and the full path should be snippets/how-to-reverse-a-string/main_test.go

    • Do no edit anything inside docs folder. It is generated automatically on succesful merge

    • Do no edit README.md. It is generated automatically on succesful merge. Edit https://github.com/psampaz/gophersnippets/edit/contributing/tools/templates/readme.md instead.

License

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

About

Code snippets with tests and testable examples for the Go programming language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published