Skip to content

jjeanjacques10/golang-notes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Notes GO

Repository for record my learning in GO.

Courses and Videos

Notes

  • := : Declaration and attribution
  • & : The address of
  • Function to return two values
func getTwoNumbers() (int, int) {
 number1 := 1
 number2 := 2
 return number1, number2
}

number1, number2 := getTwoNumbers()
_, number2 := getTwoNumbers() // Ignore first return
  • while not exist, but you can use for
for {

}
  • Create a slice (array abstract and dynamic)
func showNames(){
 names := []string {"Jean", "Alice", "Kal-El"}
 fmt.Println(names)
}
  • Convert types using strconv

Project Structure

  • /pkg: This is where to save all installed dependencies in your projects
  • /src: This is where all the code is saved.
    • Example: /github.com/jjeanjacques10/crud-golang
  • /bin: This is where you save the binaries that the "go install" command uses to compile

GOPATH vs GOROOT

  • $GOROOT is an environment variable that specifies the location of the Go runtime. It is typically set when Go is installed and should not need to be modified.
  • $GOPATH, on the other hand, is an environment variable that specifies the location of your Go workspace, where your Go code and dependencies are stored.

Documentation

About

Repository for record my learning in GO

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages