Skip to content

Commit 22469a2

Browse files
author
Mihai Bojin
authored
INTMDB-232: Fix user agent version (#505)
1 parent 1adcadb commit 22469a2

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ builds:
1414
flags:
1515
- -trimpath
1616
ldflags:
17-
- -s -w -X mongodbatlas/version.ProviderVersion={{.Version}}
17+
- -s -w -X 'github.com/mongodb/terraform-provider-mongodbatlas/version.ProviderVersion={{.Version}}'
1818
goos:
1919
- freebsd
2020
- windows

GNUmakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ GOOPTS="-p 2"
99

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

1414
GOLANGCI_VERSION=v1.29.0
1515

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

4747
tools: ## Install dev tools
4848
@echo "==> Installing dependencies..."

mongodbatlas/config.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import (
55

66
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
77
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
8+
"github.com/mongodb/terraform-provider-mongodbatlas/version"
89

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

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

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

5253
// Realm
53-
optsRealm := []realm.ClientOpt{realm.SetUserAgent("terraform-provider-mongodbatlas/" + ProviderVersion)}
54+
optsRealm := []realm.ClientOpt{realm.SetUserAgent("terraform-provider-mongodbatlas/" + version.ProviderVersion)}
5455
if c.BaseURL != "" {
5556
optsRealm = append(optsRealm, realm.SetBaseURL(c.BaseURL))
5657
}

mongodbatlas/version.go renamed to version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package mongodbatlas
1+
package version
22

33
var (
44
// ProviderVersion is set during the release process to the release version of the binary

0 commit comments

Comments
 (0)