Golang-web-dev

command module
v0.0.0-...-e3a8908 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 2 Imported by: 0

README

Golang-web-dev

go.dev pkg.go.dev

Main method is the entry point.

Gohtml is just a convention. You can rename it anything.

Go packages can be imported from github if given proper package name.

To init a new project go mod init [yourModule.name]

This will create the go.mod file and the go.sum file for you and download the modules you use in your project.

Implementing an interface

interface StringToIntMapper { fun map(string: String): Int } class DefaultStringToIntMapper : StringToIntMapper { override fun map(string: String): Int { return string.toInt() } }

Capital letters make a method public else private

Defer executes the statement at the end of the function. In LIFO order.

For files we have io utils package. file, err := os.Create("./nylcogofile.text"); io.WriteString(file, "content here")

Array is less used as compare to Slice for a list of data.

Making build for windows, unix and mac go build

https://www.youtube.com/watch?v=vMpBUkIMLzY&list=PLRAV69dS1uWQGDQoBYMZWKjzuhCaOnBpa&index=50

For mongodb in local make sure mongo service is running before troubleshooting.

Write go like a senior
Different ways to initialize go struct.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL