Exercism exercises in Go.
Exercism Go Track
Exercism exercises in Go. Issues/Feedback
⚠️ Please be aware that this repository currently does not accept community contributions. This blog post explains the details.
If you have any feedback or experience problems, you can bring them up in the Go section of the Exercism forum. Development setup
If you work on this repository, you should follow some standard Go development practices. You should have a recent version of Go installed, ideally either the current release or previous release.
You will need a github account and you will need to fork exercism/go to your account.
See GitHub Help if you are unfamiliar with the process.
Clone your fork with the command: git clone https://github.com/<you>/go.
Test your clone by cding to the go directory and typing bin/fetch-golangci-lint and then bin/run-tests.
You should see tests pass for all exercises.
Note that unlike most other Go code, it is not necessary to clone this to your GOPATH. This is because this repo only imports from the standard library and isn't expected to be imported by other packages.
Your Go code should be formatted using the gofmt tool.
There is a misspelling tool. You can install and occasionally run it to find low hanging typo problems. 570 It's not added into CI since it could give false positives. Contributing Guide
Please be familiar with the contributing guide in the docs repository. This describes some great ways to get involved. In particular, please read the Pull Request Guidelines before opening a pull request. Exercism Go style
Let's walk through an example, non-existent, exercise, which we'll call fizzbuzz to see what could be included in its implementation.
Exercise configuration
An exercise is configured via an entry in the exercises array in config.json file.
If fizzbuzz is an optional exercise, it would have an entry below the core exercises that might look like:
See Exercism Docs: config.json for more info. Exercise files: Overview
For any exercise you may see a number of files present in a directory under exercises/:
This list of files can vary across exercises.
Not all exercises use all of these files.
Exercises originate their test data and README text from the Exercism problem-specification repository.
This repository collects common information for all exercises across all tracks.
However, should track-specific documentation need to be included with the exercise, files in an exercise's .meta/ directory can be used to override or augment the exercise's README.
Let's briefly describe each file:
cases_test.go - Contains generated test cases, using test data sourced from the problem-specifications repository.
Only in some exercises.
Automatically generated by .meta/gen.go.
example.go - An example solution for the exercise used to verify the test suite.
Ignored by the exercism fetch command.
See also ignored files.
fizzbuzz.go - A stub file, in some early exercises to give users a starting point.
fizzbuzz_test.go - The main test file for the exercise.
go.mod - The Go module file. This should be automatically generated by the generator code.
.meta/ - Contains files not to be included when a user fetches an exercise. See also ignored files.
.meta/description.md - Use to generate a track specific description of the exercise in the exercise's README.
.meta/gen.go - Generates cases_test.go when present.
See also synchronizing exercises with problem specifications.
.meta/hints.md - Use to add track specific information in addition to the generic exercise's problem-specification description in the README.
.meta/metadata.yml - Track specific exercise metadata, overrides the exercise metadata from the problem-specifications repository.
In some exercises there can be extra files, for instance the series exercise contains extra test files. Ignored files
When a user fetches an exercise, they do not need to get all the files within an exercise directory. For instance; the example.go files that contain an example solution, or the gen.go files used to generate an exercise's test cases. Therefore there are certain files and directories that are ignored when an exercise is fetched. These are:
ignore_pattern defined in config.json file.
This currently matches any filename that contains the word example, unless it is followedImplement New Concept Exercise: String Builder
Concept Regular Expressions: Add some more details
We're translating this repository to other languages
Review existing concepts
Implement new Concept Exercise: time-duration
numbers concept: improve about.md and introduction.md
Implement New Concept Exercise: Channels and Select
Implement New Concept Exercise: Bitwise Operators
Adding concurrency concepts to the syllabus
Improve learning experience for interfaces, errors and error wrapping