question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Action not usable via a reusable workflow?

See original GitHub issue

Description: When using setup-go as a step in a reusable workflow, simple jobs such as go test fail.

Although GOROOT seems to be correctly set - I get results like below. As soon as as the step is removed, it works.

e.g.

go: downloading github.com/sirupsen/logrus v1.8.1
go: downloading github.com/elastic/go-elasticsearch/v7 v7.13.1
go: downloading cloud.google.com/go v0.99.0
go: downloading github.com/stretchr/testify v1.7.0
go: downloading github.com/360EntSecGroup-Skylar/excelize/v2 v2.4.0
go: downloading github.com/olivere/elastic/v7 v7.0.31
go: downloading cloud.google.com/go/datastore v1.6.0
go: downloading github.com/gorilla/mux v1.8.0
go: downloading github.com/joho/godotenv v1.4.0
go: downloading github.com/prometheus/client_golang v1.11.0
go: downloading github.com/go-openapi/runtime v0.21.0
go: downloading golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
go: downloading github.com/stretchr/objx v0.2.0
go: downloading github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
go: downloading github.com/richardlehane/mscfb v1.0.3
go: downloading github.com/xuri/efp v0.0.0-20210322160811-ab561f5b45e3
go: downloading golang.org/x/net v0.0.0-20211209124913-491a49abca63
go: downloading golang.org/x/text v0.3.7
go: downloading github.com/golang/protobuf v1.5.2
go: downloading github.com/googleapis/gax-go/v2 v2.1.1
go: downloading google.golang.org/api v0.64.0
go: downloading google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb
go: downloading github.com/mailru/easyjson v0.7.7
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/go-openapi/errors v0.20.1
go: downloading github.com/go-openapi/strfmt v0.21.0
go: downloading github.com/go-openapi/swag v0.19.15
go: downloading github.com/prometheus/client_model v0.2.0
go: downloading github.com/prometheus/common v0.26.0
go: downloading github.com/richardlehane/msoleps v1.0.1
go: downloading go.opencensus.io v0.23.0
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading google.golang.org/protobuf v1.27.1
go: downloading golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
go: downloading github.com/josharian/intern v1.0.0
go: downloading github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef
go: downloading github.com/oklog/ulid v1.3.1
go: downloading go.mongodb.org/mongo-driver v1.7.3
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash v1.1.0
go: downloading github.com/prometheus/procfs v0.6.0
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
go: downloading github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
go: downloading github.com/go-stack/stack v1.8.0
Error: ../../../go/pkg/mod/github.com/prometheus/client_golang@v1.11.0/prometheus/desc.go:22:2: missing go.sum entry for module providing package github.com/cespare/xxhash/v2 (imported by github.com/prometheus/client_golang/prometheus); to add:
	go get github.com/prometheus/client_golang/prometheus@v1.11.0
Error: ../../../go/pkg/mod/github.com/360!ent!sec!group-!skylar/excelize/v2@v2.4.0/crypt.go:31:2: missing go.sum entry for module providing package golang.org/x/crypto/md4 (imported by github.com/360EntSecGroup-Skylar/excelize/v2); to add:
	go get github.com/360EntSecGroup-Skylar/excelize/v2@v2.4.0
Error: ../../../go/pkg/mod/github.com/360!ent!sec!group-!skylar/excelize/v2@v2.4.0/crypt.go:32:2: missing go.sum entry for module providing package golang.org/x/crypto/ripemd160 (imported by github.com/360EntSecGroup-Skylar/excelize/v2); to add:
	go get github.com/360EntSecGroup-Skylar/excelize/v2@v2.4.0
Error: ../../../go/pkg/mod/github.com/googleapis/gax-go/v2@v2.1.1/call_option.go:36:2: missing go.sum entry for module providing package google.golang.org/grpc (imported by cloud.google.com/go/datastore); to add:
	go get cloud.google.com/go/datastore@v1.6.0
Error: ../../../go/pkg/mod/google.golang.org/api@v0.64.0/transport/grpc/dial.go:31:2: missing go.sum entry for module providing package google.golang.org/grpc/balancer/grpclb (imported by google.golang.org/api/transport/grpc); to add:
	go get google.golang.org/api/transport/grpc@v0.64.0
Error: ../../../go/pkg/mod/github.com/googleapis/gax-go/v2@v2.1.1/call_option.go:37:2: missing go.sum entry for module providing package google.golang.org/grpc/codes (imported by cloud.google.com/go/datastore); to add:
	go get cloud.google.com/go/datastore@v1.6.0
Error: ../../../go/pkg/mod/google.golang.org/api@v0.64.0/transport/grpc/dial.go:26:2: missing go.sum entry for module providing package google.golang.org/grpc/credentials (imported by google.golang.org/api/transport/grpc); to add:
	go get google.golang.org/api/transport/grpc@v0.64.0
Error: ../../../go/pkg/mod/google.golang.org/api@v0.64.0/transport/grpc/dial.go:27:2: missing go.sum entry for module providing package google.golang.org/grpc/credentials/google (imported by google.golang.org/api/transport/grpc); to add:
	go get google.golang.org/api/transport/grpc@v0.64.0
Error: ../../../go/pkg/mod/google.golang.org/api@v0.64.0/transport/grpc/dial.go:28:2: missing go.sum entry for module providing package google.golang.org/grpc/credentials/oauth (imported by google.golang.org/api/transport/grpc); to add:
	go get google.golang.org/api/transport/grpc@v0.64.0
Error: ../../../go/pkg/mod/go.opencensus.io@v0.23.0/plugin/ocgrpc/client_stats_handler.go:23:2: missing go.sum entry for module providing package google.golang.org/grpc/grpclog (imported by go.opencensus.io/plugin/ocgrpc); to add:
	go get go.opencensus.io/plugin/ocgrpc@v0.23.0
Error: ../../../go/pkg/mod/go.opencensus.io@v0.23.0/plugin/ocgrpc/trace_common.go:22:2: missing go.sum entry for module providing package google.golang.org/grpc/metadata (imported by cloud.google.com/go/datastore); to add:
	go get cloud.google.com/go/datastore@v1.6.0
Error: ../../../go/pkg/mod/go.opencensus.io@v0.23.0/plugin/ocgrpc/client.go:21:2: missing go.sum entry for module providing package google.golang.org/grpc/stats (imported by go.opencensus.io/plugin/ocgrpc); to add:
	go get go.opencensus.io/plugin/ocgrpc@v0.23.0
Error: ../../../go/pkg/mod/github.com/googleapis/gax-go/v2@v2.1.1/apierror/apierror.go:41:2: missing go.sum entry for module providing package google.golang.org/grpc/status (imported by cloud.google.com/go/datastore); to add:
	go get cloud.google.com/go/datastore@v1.6.0
Error: ../../../go/pkg/mod/github.com/go-openapi/strfmt@v0.21.0/format.go:26:2: missing go.sum entry for module providing package github.com/mitchellh/mapstructure (imported by github.com/go-openapi/strfmt); to add:
	go get github.com/go-openapi/strfmt@v0.21.0
[go-test-report] finished in 9.641431177s

Action version: v2

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version: Tested 1.16 and 1.17

Repro steps:

Example reusable workflow

on:
  workflow_call:
    inputs:
       go-version:
         required: false
         type: string
         description: "Select the version of go to use. Accepts https://github.com/npm/node-semver"
         default: "^1.17.0"

...

unit-tests:
    name: Unit Tests
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Go environment
        uses: actions/setup-go@v2
        with:
          go-version: ${{ inputs.go-version }}

      - name: debug
        run: printenv | grep GO

      - name: tests
        run: go test ./...

     ....

example calling workflow job

go-tests:
    uses: my-org/my-project/.github/workflows/go-tests.yml@go-tests
    with:
      go-version: "^1.17.0"

Expected behavior:

Go should behave normally in a shareable workflow using the action. I can remove the setup-go step and everything works perfectly with default runner Go installation.

Actual behavior:

As soon as I add the setup-go action rather than using the default runner version - I get failures like above

The action does seem to have set the right variables 🤷🏻

Run printenv | grep GO
GOROOT_1_17_X64=/opt/hostedtoolcache/go/1.17.5/x64
GOROOT=/opt/hostedtoolcache/go/1.17.5/x64
DOTNET_NOLOGO=1
GOROOT_1_15_X64=/opt/hostedtoolcache/go/1.15.15/x64
GOROOT_1_16_X64=/opt/hostedtoolcache/go/1.16.12/x64

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
erzzcommented, Mar 25, 2022

sorry guys - notification overload and missed this completely 🙏🏻

Let me do some more checks and see … will be back soon! Thanks for your tenacity in getting my attention 😃

0reactions
dmitry-shibanovcommented, Mar 31, 2022

Hello @lrstanley. Could you please create a separate issue ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reusing workflows - GitHub Docs
You call a reusable workflow by using the uses keyword. Unlike when you are using actions within a workflow, you call reusable workflows...
Read more >
How to start using reusable workflows with GitHub Actions
Reusable workflows offer a simple and powerful way to avoid copying and pasting workflows across your repositories.
Read more >
Avoid Duplication! GitHub Actions Reusable Workflows
Using a Reusable Workflow · You create a job with no steps · You don't add a runs-on clause, because it is contained...
Read more >
Musings on GitHub Actions Reusable Workflows
Reusable workflows have just been released to beta. Some level of reuse has been possible previously using Composite Actions.
Read more >
A Deep Dive into GitHub Actions' Reusable Workflows
Reusable workflows are templates in concept, which means they will most likely need to have parameters passed in to make them specific to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found