ariga / atlas

Manage your database schema as code
https://atlasgo.io
Apache License 2.0
5.97k stars 266 forks source link

Go install not working as expected #2659

Closed PopescuStefanRadu closed 7 months ago

PopescuStefanRadu commented 7 months ago

Trying to install latest installs v0.13.1 instead of v0.21.0.

go install ariga.io/atlas/cmd/atlas@latest
go: downloading ariga.io/atlas/cmd/atlas v0.13.1
go: downloading ariga.io/atlas v0.12.2-0.20230806193313-117e03f96e45
go: downloading github.com/go-sql-driver/mysql v1.7.0
go: downloading github.com/lib/pq v1.10.7
go: downloading github.com/libsql/libsql-client-go v0.0.0-20230602133133-5905f0c4f8a5
go: downloading github.com/mattn/go-sqlite3 v1.14.16
go: downloading github.com/mitchellh/go-homedir v1.1.0
go: downloading golang.org/x/mod v0.10.0
go: downloading github.com/google/uuid v1.3.0
go: downloading github.com/1lann/promptui v0.8.1-0.20220708222609-81fad96dd5e1
go: downloading github.com/hashicorp/hcl/v2 v2.13.0
go: downloading github.com/spf13/cobra v1.7.0
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/zclconf/go-cty v1.8.0
go: downloading github.com/vektah/gqlparser/v2 v2.5.1
go: downloading entgo.io/ent v0.12.4-0.20230726082433-91c7fcc68504
go: downloading gocloud.dev v0.27.0
go: downloading github.com/fatih/color v1.13.0
go: downloading github.com/olekukonko/tablewriter v0.0.5
go: downloading golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
go: downloading github.com/go-openapi/inflect v0.19.0
go: downloading golang.org/x/text v0.9.0
go: downloading github.com/agext/levenshtein v1.2.1
go: downloading github.com/apparentlymart/go-textseg/v13 v13.0.0
go: downloading github.com/mitchellh/go-wordwrap v1.0.0
go: downloading github.com/google/go-cmp v0.5.9
go: downloading github.com/chzyer/readline v1.5.1
go: downloading golang.org/x/tools v0.8.1-0.20230428195545-5283a0178901
go: downloading github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9
go: downloading github.com/libsql/sqlite-antlr4-parser v0.0.0-20230512205400-b2348f0d1196
go: downloading nhooyr.io/websocket v1.8.7
go: downloading github.com/mattn/go-colorable v0.1.12
go: downloading github.com/mattn/go-isatty v0.0.18
go: downloading github.com/mattn/go-runewidth v0.0.9
go: downloading go.opencensus.io v0.24.0
go: downloading github.com/aws/aws-sdk-go-v2 v1.16.8
go: downloading github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.15.14
go: downloading github.com/aws/aws-sdk-go v1.44.68
go: downloading github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220816024939-bc8df83d7b9d
go: downloading github.com/aws/smithy-go v1.12.0
go: downloading github.com/google/wire v0.5.0
go: downloading github.com/fsnotify/fsnotify v1.5.4
go: downloading cloud.google.com/go/secretmanager v1.5.0
go: downloading google.golang.org/api v0.91.0
go: downloading google.golang.org/genproto v0.0.0-20220802133213-ce4fa296bf78
go: downloading cloud.google.com/go v0.103.0
go: downloading google.golang.org/grpc v1.48.0
go: downloading github.com/pingcap/tidb/parser v0.0.0-20220817134052-9709249e523a
go: downloading github.com/auxten/postgresql-parser v1.0.1
go: downloading github.com/klauspost/compress v1.15.15
go: downloading golang.org/x/sys v0.7.0
go: downloading golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f
go: downloading github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.15
go: downloading github.com/aws/aws-sdk-go-v2/config v1.15.15
go: downloading golang.org/x/oauth2 v0.0.0-20220722155238-128564f6959c
go: downloading cloud.google.com/go/iam v0.3.0
go: downloading github.com/googleapis/gax-go/v2 v2.4.0
go: downloading google.golang.org/protobuf v1.28.1
go: downloading golang.org/x/net v0.9.0
go: downloading github.com/golang/protobuf v1.5.2
go: downloading github.com/pingcap/errors v0.11.5-0.20210425183316-da1aaba5fb63
go: downloading github.com/cockroachdb/errors v1.8.2
go: downloading github.com/cockroachdb/apd v1.1.1-0.20181017181144-bced77f817b4
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
go: downloading github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.9
go: downloading github.com/aws/aws-sdk-go-v2/credentials v1.12.10
go: downloading github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.9
go: downloading github.com/aws/aws-sdk-go-v2/internal/ini v1.3.16
go: downloading github.com/aws/aws-sdk-go-v2/service/sso v1.11.13
go: downloading github.com/aws/aws-sdk-go-v2/service/sts v1.16.10
go: downloading cloud.google.com/go/compute v1.7.0
go: downloading github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7
go: downloading go.uber.org/zap v1.21.0
go: downloading github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548
go: downloading github.com/gogo/protobuf v1.3.2
go: downloading github.com/sirupsen/logrus v1.8.1
go: downloading go.uber.org/atomic v1.9.0
go: downloading github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f
go: downloading github.com/cockroachdb/redact v1.0.8
go: downloading github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2
go: downloading github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.9
go: downloading gopkg.in/natefinch/lumberjack.v2 v2.0.0
go: downloading github.com/getsentry/raven-go v0.2.0
go: downloading go.uber.org/multierr v1.8.0
go: downloading github.com/grpc-ecosystem/grpc-gateway v1.16.0
go: downloading golang.org/x/sync v0.1.0
go: downloading github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0
go: downloading github.com/kr/pretty v0.3.0
go: downloading github.com/googleapis/enterprise-certificate-proxy v0.1.0
go: downloading github.com/jmespath/go-jmespath v0.4.0
go: downloading github.com/benbjohnson/clock v1.1.0
go: downloading github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054
go: downloading github.com/dustin/go-humanize v1.0.0
go: downloading github.com/kr/text v0.2.0
go: downloading github.com/rogpeppe/go-internal v1.6.1

Trying to install v0.21.0 fails.

go install ariga.io/atlas/cmd/atlas@v0.21.0
go: ariga.io/atlas/cmd/atlas@v0.21.0: module ariga.io/atlas@v0.21.0 found, but does not contain package ariga.io/atlas/cmd/atlas

Could you please have a look into this issue? Thanks!

PopescuStefanRadu commented 7 months ago

Installing it via commit sha of v0.21.0 yields:

go install ariga.io/atlas/cmd/atlas@464a1733e51650d30f75b7d924129db0576a4ff5
go: downloading ariga.io/atlas/cmd/atlas v0.13.2-0.20240401184920-464a1733e516
go: ariga.io/atlas/cmd/atlas@464a1733e51650d30f75b7d924129db0576a4ff5 (in ariga.io/atlas/cmd/atlas@v0.13.2-0.20240401184920-464a1733e516):
        The go.mod file for the module providing named packages contains one or
        more replace directives. It must not contain directives that would cause
        it to be interpreted differently than if it were the main module.
a8m commented 7 months ago

Hey @PopescuStefanRadu 👋

You can use the following command to install Atlas:

curl -sSf https://atlasgo.sh | sh

Regarding Go installation: We no longer maintain the cmd/atlas package as an executable - mainly for technical and time reasons. Atlas is used by various programming languages, like Python and Java, and the binary we distribute includes additional capabilities.

This is a major inconvenience for us without any obvious underlying technical reason.

Our cmd/atlas package uses replace to avoid adding all cmd/atlas dependencies for projects that use the root package - ariga.io/atlas (e.g., entgo.io). There's no way to go get such packages - we previously used go.work for this purpose, but it introduced different pains, and I decided to remove it.

kantum commented 7 months ago

@a8m Thank you for this explanation, is it possible to add a deprecation notice here https://pkg.go.dev/ariga.io/atlas/cmd/atlas?

Also, you closed the issue with "completed", when "won't fix" feels more appropriate, not a big deal but kind of misleading for future generations.

a8m commented 7 months ago

Also, you closed the issue with "completed", when "won't fix" feels more appropriate, not a big deal but kind of misleading for future generations.

I didn't know it's possible until now :D