DEV Community

Cover image for invalid go version '1.21.4': must match format 1.23

invalid go version '1.21.4': must match format 1.23

Mathias Jiya on January 31, 2024

Todays article is about how to get passed this error. So, I was trying to setup a GitHub workflow (golangci-lint and tests) for a project I am work...
Collapse
 
mrwormhole profile image
Talha Altınel • Edited

go mod tidy and golangci-lint works in every version? curious what GH action you are using on

Collapse
 
iqquee profile image
Mathias Jiya

This is the GitHub actions I was trying to run. For some reasons, on this line run: cd src && go get && go mod tidy && go test ./... it returned an maximum go version supported by go mod tidy and after updating the go version everything works as they should.

on: [pull_request]
name: tests
jobs:
  test-service:
    runs-on: ubuntu-latest
    steps:
      - name: Install Go
        uses: actions/setup-go@v2
        with:
          go-version: ${{ matrix.go-version }}
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Install dependencies
        run: cd src && go get github.com/golang/mock/mockgen@v1.6.0
      - name: test
        run: cd src && go get && go mod tidy && go test ./...
Enter fullscreen mode Exit fullscreen mode


sh

Collapse
 
mrwormhole profile image
Talha Altınel

some of the GH actions look like in older versions, I would recommend updating them then also pls do not mutate the state of go.mod via go get during a CI/CD phase. Anything that runs go test or go build automatically does go mod download if vendor file is not created specifically via go mod vendor , you don't really need to run go get or go mod tidy in any of these cases

Thread Thread
 
iqquee profile image
Mathias Jiya

Thanks boss.