# Packages
No description provided by the author
# README
Journal
This repo is my Go learning journal.
Check Version Used
Go -
go version
Go Lint -
golangci-lint --version
Installation
Go - Download and install go from here Godoc -
go install golang.org/x/tools/cmd/godoc@latest
Launch godoc by -
godoc -http :8000
then visit localhost:8000/pkg/ to access Go docs.
Errcheck -
go install github.com/kisielk/errcheck@latest
Instruction 1: Go project initialization
go mod init github.com/himalayanegi10/go-with-tests
Instruction 2: Running a go file
go run <filename>.go
Instruction 3: Testing in Go
go test
Instruction 4: Run Example in Go
go test -v
Instruction 5: Benchmarking in Go
In Linux -
go test -bench=.
In windows -
go test -bench="."
Sample Output-
goos: windows
goarch: amd64
pkg: github.com/himalayanegi10/go-with-tests/src/iteration
cpu: AMD Ryzen 7 5800H with Radeon Graphics
BenchmarkRepeat-16 13069944 88.61 ns/op
PASS
ok github.com/himalayanegi10/go-with-tests/src/iteration 1.681s
Instruction 6: Coverage in Go
Coverage can be tested by -
go test -cover
Instruction 7: Error Check in Go
errcheck is used to check errors -
errcheck .
Instruction 8: Race test in Go
Race can be tested by -
go test -race
Instruction 9: Vet in Go
Code can be tested for subtle bugs by vet
go vet
Instruction 10: Download packages in Go
New packages used in imports can be downloaded by mod tidy
go mod tidy