diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f45b41833..2de018cea 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -17,6 +17,9 @@ jobs: go-version: ["1.20.x", "1.21.x", "1.22.0-rc.1"] steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 # history/tags are needed for automatic version generation + fetch-tags: true - name: Set up Go uses: actions/setup-go@v3 diff --git a/cmd/gvproxy/main.go b/cmd/gvproxy/main.go index 8e534a25f..a2efaa428 100644 --- a/cmd/gvproxy/main.go +++ b/cmd/gvproxy/main.go @@ -274,7 +274,7 @@ func main() { }) // Wait for all of the go funcs to finish up if err := groupErrs.Wait(); err != nil { - log.Error(err) + log.Errorf("gvproxy exiting: %v", err) exitCode = 1 } } @@ -341,7 +341,7 @@ func run(ctx context.Context, g *errgroup.Group, configuration *types.Configurat if vpnkitSocket != "" { vpnkitListener, err := transport.Listen(vpnkitSocket) if err != nil { - return err + return errors.Wrap(err, "vpnkit listen error") } g.Go(func() error { vpnloop: @@ -368,7 +368,7 @@ func run(ctx context.Context, g *errgroup.Group, configuration *types.Configurat if qemuSocket != "" { qemuListener, err := transport.Listen(qemuSocket) if err != nil { - return err + return errors.Wrap(err, "qemu listen error") } g.Go(func() error { @@ -383,7 +383,6 @@ func run(ctx context.Context, g *errgroup.Group, configuration *types.Configurat conn, err := qemuListener.Accept() if err != nil { return errors.Wrap(err, "qemu accept error") - } return vn.AcceptQemu(ctx, conn) }) @@ -392,7 +391,7 @@ func run(ctx context.Context, g *errgroup.Group, configuration *types.Configurat if bessSocket != "" { bessListener, err := transport.Listen(bessSocket) if err != nil { - return err + return errors.Wrap(err, "bess listen error") } g.Go(func() error { @@ -416,7 +415,7 @@ func run(ctx context.Context, g *errgroup.Group, configuration *types.Configurat if vfkitSocket != "" { conn, err := transport.ListenUnixgram(vfkitSocket) if err != nil { - return err + return errors.Wrap(err, "vfkit listen error") } g.Go(func() error { @@ -430,7 +429,7 @@ func run(ctx context.Context, g *errgroup.Group, configuration *types.Configurat g.Go(func() error { vfkitConn, err := transport.AcceptVfkit(conn) if err != nil { - return err + return errors.Wrap(err, "vfkit accept error") } return vn.AcceptVfkit(ctx, vfkitConn) }) diff --git a/pkg/types/version.go b/pkg/types/version.go index 845ba439b..c371601c5 100644 --- a/pkg/types/version.go +++ b/pkg/types/version.go @@ -45,6 +45,16 @@ func moduleVersion() string { return gitArchiveVersion // This will be set when building from git using make case gitVersion != "": + if !strings.HasPrefix(gitVersion, "v") { + // if an annotated tag is found, the git describe string will be similar to: + // v0.7.2-15-g2c897d90 + // When using shallow clones, the commit being built + // may not have an annotated tag in its history, + // `git describe` will only be the abbreviated commit hash in this case: + // 2c897d90 + return fmt.Sprintf("git%s", gitVersion) + + } return gitVersion // moduleVersionFromBuildInfo() will be set when using `go install` default: