- How to set up a simple project
- How to run a project
go mod init example/hello
go run . # or go run hello.goWhen creating a package to be imported. There is a need to describe the path to the module and the module name. module github.com/sirupsen/logrus
In this case "github.com/sirupsen/" is the path to the module "logrus" is the module name.
Define a module and do a linkage of module to one contained in the local path
It allows a single go function to handle multiple incoming types. E.g. summing all float items and all int items
Chinese Characters can be multiple bytes but it is considered 1 rune.
go build . this creates a local file which can be run. (very similar to install, but the build result is within the directory)
go install example/user/hello builds an executable binary and then installs it as $GOBIN/go/bin/hello. If GOBIN is set, it will be installed there, else it goes into GOPATH.
This is useful for creating terminal commands.