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.

Retrieve go version from go.mod file

See original GitHub issue

Description: Instead of hard-coding the go version, the action could (optionally)

  • search in the root of the project (or in any other configurable place) for a go.mod file
  • extract and use the go version specified there.

Justification: Justification or a use case for your proposal.

Are you willing to submit a PR?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:23
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
TMaYaDcommented, Feb 10, 2022

FWIW, this is the workaround I use:

      - run: sed -En 's/^go[[:space:]]+([[:digit:].]+)$/GO_VERSION=\1/p' go.mod >> $GITHUB_ENV
      - uses: actions/setup-go@v2
        with:
          go-version: ${{ env.GO_VERSION }}
1reaction
IvanZosimovcommented, May 12, 2022

Hello, @pantelis-karamolegkos 👋 Thank you and all others for contributing! We are closing this issue because this PR has been successfully merged. If you have any questions or additions feel free to ping us.

Cheers!

Read more comments on GitHub >

github_iconTop Results From Across the Web

go.mod file reference - The Go Programming Language
Specifies a module or module version to exclude from the current module's dependency graph. For more, see exclude directive in the Go Modules...
Read more >
How to upgrade the go version in a go mod - Stack Overflow
How to upgrade the go version in a go mod · 7. Edit the file by hand or use go mod edit -go=1.14...
Read more >
How to Use Go Modules | DigitalOcean
The next step is to create a go.mod file within the mymodule directory to ... Using go get to add the latest version...
Read more >
Go Modules Cheat Sheet - Encore.dev
Find all dependencies the main module needs (recursively, using the dependencies' go.mod files); For each dependency, use the greatest version that any go.mod ......
Read more >
How To Upgrade To A Major Version In Go - Golang Cafe
go get github.com/awesomerepo/pkg@v2.0.0 invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2....
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