Skip to content

Latest commit

 

History

History
44 lines (40 loc) · 1.08 KB

go-cheat-sheet.md

File metadata and controls

44 lines (40 loc) · 1.08 KB

Go lang cheat sheet

# default path according: https://go.dev/doc/install
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
# go libraries/packages path
export GOPATH=/home/soft/go_lib

Links

Issues

bazel buildfier

intention

go install github.com/bazelbuild/buildtools/buildifier@latest

error message

can't load package: package github.com/bazelbuild/buildtools/buildifier@latest: cannot use path@version syntax in GOPATH mode

solution

GOPATH=/home/projects/goroot
go install github.com/bazelbuild/buildtools/buildifier
cd $GOPATH/src/github.com/bazelbuild/buildtools/buildifier
bazel build :all

possible (didn't check it) alternative way

go mod init buildifier
# go mod init .
go mod download repo@version
# go mod download github.com/bazelbuild/buildtools/buildifier@latest

buildfier

/home/projects/goroot/bin/buildifier -mode fix {file_path}
# bazel run //bazel/tools/buildifier:fix