# Go

## 00. Basic&#x20;

```bash
## ------------------| Install
### Download and install from https://go.dev/dl/
go version

## ------------------| Create project
mkdir hello-world && hello-world
go mod init hello-world
touch main.go

## ------------------| main.go
package main

import "fmt"

func main() {
    fmt.Println("Hello, World!") //This is a single-line comment
}

## ------------------| Add Dependency 
### Method I
go get github.com/gin-gonic/gin
go get -u github.com/gin-gonic/gin # update to the latest version
go get -u ./... # update all dependencies
### Method II
package main

import (
    "fmt"
    "github.com/gin-gonic/gin" // Add Dependency here!
)

func main() {
    fmt.Println("Using Gin Web Framework")
    r := gin.Default()
    r.GET("/", func(c *gin.Context) {
        c.JSON(200, gin.H{"message": "Hello, World!"})
    })
    r.Run()
}

## ------------------| Run the program 
go run main.go

## ------------------| Build the program
go build
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.h4rithd.com/languages/go.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
