notes/computery_stuff/go.md
2021-12-23 15:41:57 +00:00

1.5 KiB
Executable File

author date title tags
Alvie Rahman \today Go (golang)
golang
programming

Getting Up to Speed With Go

Probably the most useful resoure I found was the Tour of Go. It's easy to understand and teaches you all you need to know.

godoc 1

Godoc parses Go source code - including comments - and produces documentation as HTML or plain text. The end result is documentation tightly coupled with the code it documents. For example, through godoc's web interface [which is at http://localhost:6060 by default] you can navigate from a function's documentation to its implementation with one click.

Installing godoc // command not found: godoc

go get golang.org/x/tools/cmd/godoc

go.mod

replace 2

go mod edit -replace old.repo/location=../new/location

or

echo "old.repo/location => ../new/location" >> go.mod

The -replace=old[@v]=new[@v] flag adds a replacement of the given module path and version pair. If the @v in old@v is omitted, a replacement without a version on the left side is added, which applies to all versions of the old module path. If the @v in new@v is omitted, the new path should be a local module root directory, not a module path. Note that -replace overrides any redundant replacements for old[@v], so omitting @v will drop existing replacements for specific versions