Giter VIP home page Giter VIP logo

gopherlings's Introduction

gopherlings

๐Ÿ“˜๏ธ Learn Go by fixing tiny incorrect programs

This project was directly inspired by the great ziglings project which itself was inspired by rustlings.

For a first time learner it is suggested you complement this material with another source such as

Intended Audience

These exercises will probably be difficult if you've never programmed before.

The exercises should be self-contained and self-explained, though this is a WIP and suggestions are welcome!

Instructions: Running exercises

Requires a Go installation to run the examples.

Instructions using VSCode

  1. Download the repository (or alternatively clone it)

  2. Install the VSCode Go extension authored by Go Team at Google

  3. Open the gopherlings folder in VSCode

  4. Navigate to the exercise file, i.e. exercises/001-hello/hello.go

  5. Once the hello.go file is open you may edit it and press F5 to run it. Output will be shown in the Debug Console.

Instructions using terminal

  1. Clone repository

    git clone https://github.com/soypat/gopherlings.git 
  2. Navigate to example's directory

    cd gopherlings/exercises/001-hello
  3. Edit the file so it is correct and run it with go run

    go run hello.go

    Optionally, instead of step 3, use gopherlings watch to auto reload your code after you save your code. Then you will see your code output without any action. You can simply focus on your code.

    go install github.com/soypat/gopherlings/cmd/gopherlings@latest
    gopherlings watch
    gopherlings help  # To see other commands

    Note: You need to define your GOBIN environment variable before running go install and add it to your PATH. GOBIN specifies the directory to which go binaries are installed to.

Roadmap

Short term

  • Add quizzes after $n$ exercises.
    • Possibly add several quizzes of varying difficulty inside quiz directory.
  • Improve the helper program.
    • A hint subcommand or interactive hints during the watch command.
    • Allow run to take an argument that runs a specific exercise.
    • Add a subcommand to run all exercises and check them against expected output.
    • Catch errors that prevent the helper from running exercises (like an incomplete Go installation).

Long term

  • Have exercises that cover the entire Go spec.

gopherlings's People

Contributors

benluo avatar charlritter avatar jdkaplan avatar mcgeerdev avatar mubashirmalik avatar shadowninja55 avatar soypat avatar srnissen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gopherlings's Issues

Suggested correction to explanatory text for exercise 14

The current text is technically false. As of today, it is written:

// Problem:
// For statements can also have init and post statements in the clause.
//
//  for i := 0; i <= 10; i = i + 1 {
//      fmt.Println(i)
//  }
//
// The above for loop will iterate from 0 to 10 and is
// identical in functionality to the following
// single-condition for statement:
//
//  i := 0
//  for i <= 10 {
//      fmt.Println(i)
//      i = i + 1
//  }

which would leave i in scope after the loop block, which is true in some languages but not here.

Proposed change

The exercise text could instead be

// Problem:
// For statements can also have init and post statements in the clause.
//
//  for i := 0; i <= 10; i = i + 1 {
//      fmt.Println(i)
//  }
//
// The above for loop will iterate from 0 to 10 and is
// identical in functionality to the following
// single-condition for statement:
//
// {
//      i := 0
//      for i <= 10 {
//          fmt.Println(i)
//          i = i + 1
// }

"I am still going" missing in exercise 20 sliceref

Background

I finished exercise 19 and the gopherlings watch window gave me an error message that did not at all resemble exercise 20 (because it skipped directly to exercise 21)

Proposed change

Add

// I AM STILL GOING

to exercise 20

EDIT: Also separately - thank you for maintaining this repo. Despite what my issues might indicate, I am very happy to have this training resource.

gopherlings watch stops after 30 exercises

Background

After finishing "030-pointermethod2" the gopherlings watch window prints a congratulatory message - even though there are (currently) 32 problems in the set.

Proposed change

Do something else :D

Sorry, I don't have insight into the gopherlings watch program, I don't know if this is as simple as changing "30" to "32" or if this is a colossal change request.

gopherlings: command not found

I'm trying to run this similar to rustlings (rustlings watch). I followed the instructions in the readme and no matter what I do, i can not get the gopherlings command to work. Does anyone have any suggestions? Thank you.

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.