Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

rustlings but for golang this time

License

NotificationsYou must be signed in to change notification settings

mauricioabreu/golings

Repository files navigation

build and test

gopher

rustlings but for golang this time

You may knowrustlings, right? If you don't, please go ahead and check out.rustlings is awesome. It is a CLI app designed to teach the awesome Rust programming language through exercises.

golings has the very same idea, but for theGo programming language

After setting up all the tools required to rungolings you have the task to fix tiny go programs.

Installing

First, you need to havego installed. You can install it by visiting theGo downloads page

There are several ways to installgolings

Option 1: GO install

go install github.com/mauricioabreu/golings/golings@latest

Addgo/bin to your PATH if you want to run golings anywhere in your terminal. From the official docs:

The install directory is controlled by the GOPATH and GOBIN environment variables. If GOBIN is set, binaries are installed to that directory. If GOPATH is set, binaries are installed to the bin subdirectory of the first directory in the GOPATH list. Otherwise, binaries are installed to the bin subdirectory of the default GOPATH ($HOME/go or %USERPROFILE%\go).

Windows installation

Some tests depend onCGO which is not installed by default.

  1. Install scoop package managerScoop Homepage
    Set-ExecutionPolicy-ExecutionPolicy RemoteSigned-Scope CurrentUserInvoke-RestMethod-Uri https://get.scoop.sh|Invoke-Expression
  2. Install MINGW using scoop
    scoop install mingw
  3. Close the Powershell session

Option 2: Binaries

Go to thereleases page and choose the option that best fits your environment.

Option 3: Web version (playground)

@Grubba27 worked hard to create a web version:https://golings.vercel.app/

It's pretty awesome and uses the playground so you can play with the exercises without installing anything.

Option 4: DevContainer

  1. Install Docker/Podman & VSCode & Configure
  2. Clone the repository and open it in VSCode.
  3. You will be prompted to reopen the code in a devcontainer. The container is pre-configured with go and all of the tools needed to debug go code.
  4. Open a new embeded terminal and rungolings watch to start the exercises.

Doing exercises

All the exercises can be found in the directorygolings/exercises/<topic>. For every topic there is an additional README file with some resources to get you started on the topic. We really recommend that you have a look at them before you start.

Now you have the task to fix all the programs. Some of them don't compile, and you need to fix them. Some of them compile, but have tests and you need to write some code to have them all green (these are thecompile andtest modes).

Clone the repository:

git clone git@github.com:mauricioabreu/golings.git

To run the exercises in the recommended order while taking advantage of fast feedback loop, use thewatch command:

golings watch

For Windows:

$env:CGO_ENABLED=1golings watch

This command will run golings in interactive mode. Every time you save a file it will verify if the code is correct.

To run the next pending exercise:

golings run next

If you want to run a single exercise:

golings run variables1

In case you are stuck and need a hint:

golings hint variables1

To list all exercise while checking your progress:

golings list

To compile and run all the exercises:

golings verify

If you need help with CLI commands:

golings --help

A demo running the commandgolings run <exercise name>

demo

Contributing

SeeCONTRIBUTING.md

Learning resources

Other 'lings


[8]ページ先頭

©2009-2025 Movatter.jp