Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve gvproxy error reporting, and improve gvproxy --version in a corner case #315

Merged
merged 3 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions cmd/gvproxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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:
Expand All @@ -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 {
Expand All @@ -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)
})
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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)
})
Expand Down
10 changes: 10 additions & 0 deletions pkg/types/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading