# GO Vendor

Go Vendor digunakan untuk mengunduh semua dependency atau *3rd party*, untuk disimpan di lokal dalam folder project, dalam folder bernama `vendor`.

Dengan adanya folder tersebut, maka Go tidak akan *lookup* 3rd party ke cache folder, melainkan langsung mempergunakan yang ada dalam folder `vendor`. Jadi tidak perlu download lagi dari internet.

Misalnya kita ingin menggunakan external [package](https://github.com/rhymond/go-money) bernama `go-money` .

Kita lakukan terlebih dahulu proses instalasi:

```
go get github.com/Rhymond/go-money
```

Setelah selesai instalasi, kita akan coba menggunakan package tersebut melalui `main.go` :

```go
package main

import (
	"fmt"

	"github.com/Rhymond/go-money"
)

func main() {
	result := money.New(250000, "IDR").Display()
	fmt.Println(result)
}
```

Untuk menggunakan Go Vendor, kita akan menggunakan perintah berikut pada command line:

```
go mod vendor
```

Perintah di atas akan secara otomatis mendownload depedency yang dibutuhkan untuk setiap external package pada folder `vendor` :

![Ilustrasi isi dari folder vendor](/files/-MTpGaMz6EzjZXGaeHJJ)


---

# 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://davidwinalda94.gitbook.io/mastering-golang/go-vendor.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.
