Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@owenwaller
Copy link
Collaborator

An initial version of the proposed vugu command, from Issue #340 #340

The only supported sub command is "version" which prints the version information. For example:

vugu version v0.4.0-139-g3fe0108-dirty

The magefiles have been updated so that the build target now automatically inserts the correct version information into the vugu binary, based on the output of a git describe --dirty command.

If the vugu tool is built outside of the magefile e.g. with "go build github.com/vugu/vugu/cmd/vugu" or otherwise outside of the repo then the version information only contains the full hash of the last commit and an indication if the repo was dirty.

The different formats allow the build method to be inferred.

The vugu tool is built with the "github.com/urfave/cli/v3" package, which simplifies the development of the sub commands, flag parsing and help information.

An initial version of the proposed `vugu` command, from Issue vugu#340
vugu#340

The only supported sub command is "version" which prints the version
information. For example:

vugu version v0.4.0-139-g3fe0108-dirty

The magefiles have been updated so that the `build` target now
automatically inserts the correct version information into the
`vugu` binary, based on the output of a `git describe --dirty` command.

If the `vugu` tool is built outside of the magefile e.g. with "go build
github.com/vugu/vugu/cmd/vugu" or otherwise outside of the repo then the version information only contains
the full hash of the last commit and an indication if the repo was
dirty.

The different formats allow the build method to be inferred.

The `vugu` tool is built with the "github.com/urfave/cli/v3" package,
which simplifies the development of the sub commands, flag parsing and help information.
By default the checkout action does not checkout the repos tags, and only
checks out the last commit.

This causes a failure because the magefile calls `git describe --dirty`
to determine the correct version string, which is relative to the last
tag.

If there are no tags, the `git describe --dirty` fails which in turn
causes the build to fail.

The checkout action not explictly checks out the tags.
Seems the "fetch-tags: true" does not checkout the tags.
So in addition we fetch teh whoel repo history with "fetch-depth=0".
This will slow down the checkout process.
Wasm tests test-012-router and test-013-issue-117 both depend on the root
module github.com/vugu/vugu.

As that module now depends on github.com/urfave/cli/v3 both of these
tests now have an indirect dependency on github.com/urfave/cli/v3.

Consequently the go.sum of both tests needs to be updated via a go mod
tidy which will add the indirect dependency.
The cli package supports both a "-v" and a "--version" flag by default.
In addition the `vugu` command will print its help information, which
includes its version number, if no arguments are passed.

The first two cases require setting the cli.VersionPrinter function
to the version.Version function.

The last case requires that the version information is read at
startup. If we fail to read the built in build information at this
point we report an error and exit. Once the version has been read we
need to chop off the "vugu version" prefix. This ensures that when the
version information is displayed as part of the vugu commands help it is
displayed correctly. When called via the "-v", "--version" or "version"
sub command the prefix is always displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant