Skip to content

Commit 9ec5dbc

Browse files
committed
split constants outside version file
1 parent 35064b6 commit 9ec5dbc

File tree

2 files changed

+29
-27
lines changed

2 files changed

+29
-27
lines changed

common/constants.go

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package common
2+
3+
import "context"
4+
5+
var (
6+
// ResourceName is resource name without databricks_ prefix
7+
ResourceName contextKey = 1
8+
// Provider is the current instance of provider
9+
Provider contextKey = 2
10+
// Current is the current name of integration test
11+
Current contextKey = 3
12+
// If current resource is data
13+
IsData contextKey = 4
14+
// apiVersion
15+
Api contextKey = 5
16+
// SDK used
17+
Sdk contextKey = 6
18+
)
19+
20+
type contextKey int
21+
22+
func (k contextKey) GetOrUnknown(ctx context.Context) string {
23+
rn, ok := ctx.Value(k).(string)
24+
if !ok {
25+
return "unknown"
26+
}
27+
return rn
28+
}

common/version.go

+1-27
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,6 @@
11
package common
22

3-
import "context"
4-
5-
var (
6-
version = "1.73.0"
7-
// ResourceName is resource name without databricks_ prefix
8-
ResourceName contextKey = 1
9-
// Provider is the current instance of provider
10-
Provider contextKey = 2
11-
// Current is the current name of integration test
12-
Current contextKey = 3
13-
// If current resource is data
14-
IsData contextKey = 4
15-
// apiVersion
16-
Api contextKey = 5
17-
// SDK used
18-
Sdk contextKey = 6
19-
)
20-
21-
type contextKey int
22-
23-
func (k contextKey) GetOrUnknown(ctx context.Context) string {
24-
rn, ok := ctx.Value(k).(string)
25-
if !ok {
26-
return "unknown"
27-
}
28-
return rn
29-
}
3+
var version = "1.73.0"
304

315
// Version returns version of provider
326
func Version() string {

0 commit comments

Comments
 (0)