Skip to content

Commit

Permalink
INTMDB-232: Fix user agent version (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
MihaiBojin committed Aug 5, 2021
1 parent 1adcadb commit 22469a2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Expand Up @@ -14,7 +14,7 @@ builds:
flags:
- -trimpath
ldflags:
- -s -w -X mongodbatlas/version.ProviderVersion={{.Version}}
- -s -w -X 'github.com/mongodb/terraform-provider-mongodbatlas/version.ProviderVersion={{.Version}}'
goos:
- freebsd
- windows
Expand Down
4 changes: 2 additions & 2 deletions GNUmakefile
Expand Up @@ -9,7 +9,7 @@ GOOPTS="-p 2"

GITTAG=$(shell git describe --always --tags)
VERSION=$(GITTAG:v%=%)
LINKER_FLAGS=-X mongodbatlas/version.ProviderVersion=${VERSION}
LINKER_FLAGS=-s -w -X 'github.com/mongodb/terraform-provider-mongodbatlas/version.ProviderVersion=${VERSION}'

GOLANGCI_VERSION=v1.29.0

Expand Down Expand Up @@ -42,7 +42,7 @@ websitefmtcheck:
lint:
@echo "==> Checking source code against linters..."
# https://github.com/golangci/golangci-lint/issues/337 fixing error
golangci-lint run ./$(PKG_NAME) -v --deadline=30m
bin/golangci-lint run ./$(PKG_NAME) -v --deadline=30m

tools: ## Install dev tools
@echo "==> Installing dependencies..."
Expand Down
7 changes: 4 additions & 3 deletions mongodbatlas/config.go
Expand Up @@ -5,8 +5,9 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
"github.com/mongodb/terraform-provider-mongodbatlas/version"

digest "github.com/mongodb-forks/digest"
"github.com/mongodb-forks/digest"
matlasClient "go.mongodb.org/atlas/mongodbatlas"
realmAuth "go.mongodb.org/realm/auth"
"go.mongodb.org/realm/realm"
Expand Down Expand Up @@ -38,7 +39,7 @@ func (c *Config) NewClient(ctx context.Context) (interface{}, diag.Diagnostics)

client.Transport = logging.NewTransport("MongoDB Atlas", transport)

optsAtlas := []matlasClient.ClientOpt{matlasClient.SetUserAgent("terraform-provider-mongodbatlas/" + ProviderVersion)}
optsAtlas := []matlasClient.ClientOpt{matlasClient.SetUserAgent("terraform-provider-mongodbatlas/" + version.ProviderVersion)}
if c.BaseURL != "" {
optsAtlas = append(optsAtlas, matlasClient.SetBaseURL(c.BaseURL))
}
Expand All @@ -50,7 +51,7 @@ func (c *Config) NewClient(ctx context.Context) (interface{}, diag.Diagnostics)
}

// Realm
optsRealm := []realm.ClientOpt{realm.SetUserAgent("terraform-provider-mongodbatlas/" + ProviderVersion)}
optsRealm := []realm.ClientOpt{realm.SetUserAgent("terraform-provider-mongodbatlas/" + version.ProviderVersion)}
if c.BaseURL != "" {
optsRealm = append(optsRealm, realm.SetBaseURL(c.BaseURL))
}
Expand Down
2 changes: 1 addition & 1 deletion mongodbatlas/version.go → version/version.go
@@ -1,4 +1,4 @@
package mongodbatlas
package version

var (
// ProviderVersion is set during the release process to the release version of the binary
Expand Down

0 comments on commit 22469a2

Please sign in to comment.