coding-memo/memo/golang.md
2025-11-04 22:29:41 +09:00

37 lines
448 B
Markdown

# Golang basics
## Initialize project
```bash
$ go mod init <project-name> #usually folder name
```
## Insert package
```go
package main
import "fmt"
func main() {
// your code here
}
```
## Running code
```bash
$ go run main.go
```
## Pointer in Go
```go
var userName string
var userTickets int
fmt.Scan(&userName)
// &userName point to the memory of the var
```
## Import package
```bash
go get github.com/gin-gonic/gin
```