http://go-database-sql.org/index.html -SQL
https://echo.labstack.com/guide/response/ -Echo Web-Framework
https://www.golinuxcloud.com/go-gorilla-mux/ -Gorilla Mux Web-Framework
https://gorm.io/docs/advanced_query.html -ORM Library for Go
- Install Go from https://golang.google.cn/doc/install
OR for Ubuntu https://buildvirtual.net/how-to-install-go-on-ubuntu-20-04/
- Open Cmd *and type *$ go version to display the Go version in order to verify that it has been successfully installed.
- Navigate to home directory using cd %HOMEPATH% command.
- Create a directory for your first Go source code using the commands below mkdir test then navigate to the folder with cd test
- Enable dependency tracking for your code. When your code imports packages contained in other modules, you manage those dependencies through your code's own module. That module is defined by a go.mod file that tracks the modules that provide those packages. Type the following command for our test directory. $ go mod init test/hello go: creating new go.mod: module example/hello
- Create a file test.go where you will write your code. package main. Below is an example.
package main
import "fmt"
func main() {
fmt.Println("Hello, Jay!")
}
- Run your code using $ go run . The following is displayed- Hello, Jay!
Essential Go Commands
go mod vendor command constructs a directory named vendor in the main module’s root directory that contains copies of all packages needed to support builds and tests of packages in the main module.
It creates the file vendor/modules.txt that contains a list of vendored packages and the module versions they were copied from.
Vendor directories are not used in any module.
go mod tidy command ensures that the go.mod file matches the source code in the module. It adds any missing module requirements necessary to build the current module’s packages and dependencies, and it removes requirements on modules that don’t provide any relevant packages. It also adds any missing entries to go.sum and removes unnecessary entries.
go get github.com/joho/godotenv to set up go environment variables
go get -u github.com/go-sql-driver/mysql to get sql driver package
go get github.com/labstack/echo/v4 to use Echo web framework
Top comments (2)
A nice read . Im trying out Go
Pretty dope.