Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Nov 2, 2021. It is now read-only.

cedrickring/golang-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Actions Status

IMPORTANT: This action will no longer be maintained by myself and thus will not support versions newer than Golang 1.16. I highly recommend using the offical actions/setup-go action which does exactly the same as this action (+ with some more features). Originally this action was helpful when there was the requirement to properly place go projects in the $GOPATH. As this is no longer needed, setting up the proper go version is all you need. However I will kindly review and approve PRs with bugfixes only.

Golang Action

This Action allows you to run Go commands with your code. It will automatically setup your workspace (~/go/src/github.com/<your-name>/<repo>) before the command is run.

How to use

Create a workflow.yaml file in .github/workflows with the following contents:

on: push
name: My cool Action
jobs:
  checks:
    name: run
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master

    - name: run
      uses: cedrickring/golang-action@1.6.0

If no args are specified and a Makefile is detected, this action will run make. Otherwise go test and go build will be run. To run a custom command, just use:

steps:
- name: Run custom command
  uses: cedrickring/golang-action@1.6.0
  with:
    args: make my-target

If your repository's import name is different from the path on GitHub, provide the import name by adding an environment variable IMPORT=import/name. This may be useful if you have forked an open source Go project:

steps:
- name: Run with custom import path
  uses: cedrickring/golang-action@1.6.0
  env:
    IMPORT: "root/repo"

To use Go Modules add GO111MODULE=on to the step:

steps:
- name: Go Modules
  uses: cedrickring/golang-action@1.6.0
  env:
    GO111MODULE: "on"

If your go project is not located at the root of the repo you can also specify environment variable PROJECT_PATH:

steps:
- name: Custom project path
  uses: cedrickring/golang-action@1.6.0
  env:
    PROJECT_PATH: "./path/in/my/project"

To use a specific golang version (1.10, 1.11, 1.12, 1.13, 1.14, 1.15), defaults to the latest version:

steps:
- name: Use Go 1.11
  uses: cedrickring/golang-action/go1.11@1.6.0

About

A GitHub Action to run Go commands

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 10

Morty Proxy This is a proxified and sanitized view of the page, visit original site.