compose/cli/cmd
Sebastiaan van Stijn a0db32043e
Do not strip "v" prefix from version when printing
I noticed this when building the binary; `internal.Version` is set to `v2.0.0-beta.4`,
to match the tag.

```bash
GIT_TAG=v2.0.0-beta.4
make COMPOSE_BINARY=bin/docker-compose -f builder.Makefile compose-plugin \
    GOOS=linux \
    GOARCH=amd64 \
    CGO_ENABLED=0 \
    go build \
        -trimpath \
        -ldflags="-s -w -X github.com/docker/compose-cli/internal.Version=v2.0.0-beta.4" \
        -o bin/docker-compose \
        ./cmd
```

However, the binary has the `v` prefix stripped (which caused a check to fail
when packaging):

```bash
/root/rpmbuild/BUILDROOT/docker-compose-plugin-2.0.0.beta.4-0.fc34.x86_64/usr/libexec/docker/cli-plugins/docker-compose docker-cli-plugin-metadata
++ awk '{ gsub(/[",:]/,"")}; $1 == "Version" { print $2 }'
+ ver=2.0.0-beta.4
+ test 2.0.0-beta.4 = v2.0.0-beta.4
FAIL: docker-compose version (2.0.0-beta.4) did not match
```

This also looks inconsistent with other binaries and plugins we ship:

```bash
docker info --format '{{json .ClientInfo.Plugins}}' | jq .
[
  {
    "SchemaVersion": "0.1.0",
    "Vendor": "Docker Inc.",
    "Version": "v0.5.1-docker",
    "ShortDescription": "Build with BuildKit",
    "Name": "buildx",
    "Path": "/usr/libexec/docker/cli-plugins/docker-buildx"
  },
  {
    "SchemaVersion": "0.1.0",
    "Vendor": "Docker Inc.",
    "Version": "2.0.0-beta.4",
    "ShortDescription": "Docker Compose",
    "Name": "compose",
    "Path": "/usr/libexec/docker/cli-plugins/docker-compose"
  },
  {
    "SchemaVersion": "0.1.0",
    "Vendor": "Docker Inc.",
    "Version": "v0.8.0",
    "ShortDescription": "Docker Scan",
    "Name": "scan",
    "Path": "/usr/libexec/docker/cli-plugins/docker-scan"
  }
]
```

Perhaps there was a specific reason for this, but thought I'd open this PR for
discussion (if the v-prefix should not be there, perhaps we should isntead strip
it when setting the version).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-03 15:53:21 +02:00
..
context move compose API into pkg/api 2021-06-15 15:52:48 +02:00
login move compose API into pkg/api 2021-06-15 15:52:48 +02:00
logout move compose API into pkg/api 2021-06-15 15:52:48 +02:00
run Move compose v2 implementation under pkg/compose with dependencies 2021-06-15 15:52:48 +02:00
testdata Removed unit tests (using example context) that are in fact duplicates of e2e tests in test/e2e 2021-01-15 17:28:46 +01:00
volume Move compose v2 implementation under pkg/compose with dependencies 2021-06-15 15:52:48 +02:00
ecs.go Update copyright 2020-09-22 12:13:00 +02:00
exec.go Update copyright 2020-09-22 12:13:00 +02:00
inspect.go Move formatter => cli/formatter. Needed to move formatter.MemBytes => utils.MemBytes (helper class on memory display) 2021-01-15 16:47:30 +01:00
kill.go move compose API into pkg/api 2021-06-15 15:52:48 +02:00
logs.go Update copyright 2020-09-22 12:13:00 +02:00
metadata.go Add backend-metadata command (hidden) for CLI backend 2021-01-05 16:36:51 +01:00
prune.go Bump `azure-sdk-for-go`: v43.3.0 -> v48.2.0 2020-11-24 11:48:26 -03:00
ps.go Move formatter => cli/formatter. Needed to move formatter.MemBytes => utils.MemBytes (helper class on memory display) 2021-01-15 16:47:30 +01:00
rm.go move compose API into pkg/api 2021-06-15 15:52:48 +02:00
secrets.go Move formatter => cli/formatter. Needed to move formatter.MemBytes => utils.MemBytes (helper class on memory display) 2021-01-15 16:47:30 +01:00
serve.go remove obsolete compose grpc service 2021-06-01 15:33:55 +02:00
start.go move compose API into pkg/api 2021-06-15 15:52:48 +02:00
stop.go move compose API into pkg/api 2021-06-15 15:52:48 +02:00
version.go Do not strip "v" prefix from version when printing 2021-07-03 15:53:21 +02:00
version_test.go Fix tests 2020-10-01 15:41:18 +02:00