Skip to content

chris-stinemetz/learn-go-with-tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learn Go with Tests

This repository contains code for learning Go with tests, following the Learn Go with Tests book.

Structure

Each package represents a lesson and contains corresponding tests.

How to Run

go run src/main.go

How to Test

go test ./...

The ./... syntax in the go test command is a wildcard pattern that tells the Go tool to recursively find and run tests in the current directory and all its subdirectories. This is useful for running all tests in a multi-package project with a single command.

Additional Test Commands

  • Run All Tests in the Current Directory and Subdirectories:

    go test ./...
  • Run Tests in a Specific Package:

    go test ./path/to/package
  • Run Tests with Verbose Output:

    go test -v ./...
  • Run Tests with Coverage:

    go test -cover ./...
  • Run Tests and Generate a Coverage Report:

    go test -coverprofile=coverage.out ./...
    go tool cover -html=coverage.out
  • Run a Specific Test Function:

    go test -run TestFunctionName ./path/to/package

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages