diff --git a/.gitignore b/.gitignore index 2ef5f34..f89a265 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ *.out cover* + +# goreleaser builds +dist/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..343e886 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,23 @@ +# This is an example .goreleaser.yml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +before: + hooks: + - go mod tidy + - go generate ./... +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + - "386" +archives: + - replacements: + 386: i386 + amd64: x86_64 +snapshot: + name_template: "{{ .Tag }}-next" diff --git a/examples/getting-started/user_repo.go b/examples/getting-started/user_repo.go index d95fa31..a47da5e 100644 --- a/examples/getting-started/user_repo.go +++ b/examples/getting-started/user_repo.go @@ -7,6 +7,7 @@ import ( "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" ) func NewUserRepository(collection *mongo.Collection) UserRepository { @@ -31,7 +32,7 @@ func (r *UserRepositoryMongo) FindByUsername(arg0 context.Context, arg1 string) var entity UserModel if err := r.collection.FindOne(arg0, bson.M{ "username": arg1, - }).Decode(&entity); err != nil { + }, options.FindOne().SetSort(bson.M{})).Decode(&entity); err != nil { return nil, err } return &entity, nil