Skip to content

hashicorp/setup-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

setup-golang (GitHub action)

GitHub

A composite GitHub action for setting up Go compiler and module cache

  • configures Go compiler using actions/setup-go
  • configures Go modules cache using actions/cache
  • configures GOBIN environment variable to be on $PATH
  • compatible with Linux, Darwin, and Windows runners

Inputs

  • version-file - Either .go-version (default) or go.mod. Used to determine the version of Go compiler to configure.
  • cache-key - Key used to share (or not share) module cache across later actions.

Environment

  • GOBIN - Sets $GOBIN to a value on $PATH
    • currently uses $(go env GOROOT)/bin

Cache Limit

Note that GitHub limits repositories to have up to 10GiB of caches. Once the limit is exceeded, older caches will be evicted on an LRU basis.

Usage

minimal example

This example uses the default values (uses .go-version for the Go version and default as the cache key).

steps:
  - uses: hashicorp/setup-golang@v1

This example uses custom values (uses go.mod for the Go version and mykey as the cache key).

complete example

steps:
  - uses: actions/checkout@v3
  - uses: hashicorp/setup-golang@v1
    with:
      version-file: go.mod
      cache-key: mykey

Cross Platform

The cache automatically keys on operating system. The cache is not shared between Linux, Darwin, and Windows runners.

About

An action for setting up Go compiler and GitHub Actions cache

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published