golang-tour-solutions

command module
v0.0.0-...-7258381 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

README

A Tour of Go Solutions

tests lint coverage Go Report Card

This repository contains my solutions to the exercises in "A Tour of Go".

Running the Code

To run the code, you need to have Go installed on your machine. You can download it from the official Go website.

Once you have Go installed, you can use the tour.go file to run the exercises. Open a terminal, navigate to the directory where the tour.go file is located, and run the following command:

go run tour.go <module> <program>

Replace <module> with the name of the module you want to run and <program> with the name of the program you want to run. For example, to run the hello program in the welcome module, you would run:

go run tour.go welcome hello

Individual exercises are also runnable directly. For example, to run the hello exercise in the welcome module, you can run:

go run welcome/hello/hello.go

On Windows, you may need to use go run .\welcome\hello\hello.go instead.

License

The Go Authors license the original code excerpts from the Go Tour, included or adapted from the official Go Tour repository under the BSD 3-Clause License.

My contributions and modifications are, in practice, not significant enough to warrant separate licensing, but I have chosen to license this repository under the same BSD 3-Clause License for consistency. See the LICENSE file for details.

Since intentions matter, let me state upfront that I'm using this as an exercise to refresh my knowledge of the Go language and to practise source control and versioning with Jujutsu. I couldn't care less about how you use my code. Copy it, modify it, feed it to an AI, ignore it, whatever. Just don't do anything that the original Go Tour authors and the BSD-3-Clause License don't allow.

Documentation

Overview

Package main provides a CLI tool for running Go tour examples. It executes example programs by specifying a module and program name, making it easier to run and explore the Go tour code samples.

Directories

Path Synopsis
basics
basic-types command
constants command
exported-names command
functions command
imports command
named-results command
packages command
type-inference command
variables command
zero command
flowcontrol
defer command
defer-multi command
for command
for-continued command
forever command
if command
if-and-else command
switch command
moretypes
append command
array command
exercise-slices command
making-slices command
map-literals command
maps command
mutating-maps command
nil-slices command
pointers command
range command
range-continued command
slice-bounds command
slice-len-cap command
slice-literals command
slices command
slices-of-slice command
slices-pointers command
struct-fields command
struct-literals command
struct-pointers command
structs command
Package testutils provides common testing utilities for capturing program output
Package testutils provides common testing utilities for capturing program output
welcome
hello command
sandbox command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL