Skip to content

Check the Go version before compile #78

@vbuenog

Description

@vbuenog

What?

Check the Go version installed before compiling due to errors if a older go version is installed.

Why?

When installing Go in Ubuntu 22.04 LTS from apt it installs the Go version 1.18. After that if you run

make bin

an error is shown and the command exits.

The error is

❯ make bin
go build \
	-ldflags "-X github.com/freepik-company/gommitizen/internal/app/gommitizen/version.version=0.8.3" \
	-o bin/gommitizen cmd/gommitizen/main.go
go: downloading github.com/spf13/cobra v1.8.0
go: downloading github.com/Masterminds/semver v1.5.0
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading github.com/leodido/go-conventionalcommits v0.12.0
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/sirupsen/logrus v1.9.3
go: downloading golang.org/x/sys v0.21.0
internal/app/gommitizen/git/git.go:5:2: package log/slog is not in GOROOT (/usr/lib/go-1.18/src/log/slog)
make: *** [Makefile:16: bin/gommitizen] Error 1

After searching for it is due an older Go version, so a newer version is required.

How?

When running the command make bin add a previous steps that get the Go version and if it's older than a minimum version it should show an error and exit the compilation

AC

  • When running the command make bin if the system has an old Go version it must show an error and stop.
  • The README must specify the required version of Go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions