diff --git a/audit/client.go b/audit/client.go index e2e457de..9e4d8fca 100644 --- a/audit/client.go +++ b/audit/client.go @@ -5,6 +5,7 @@ import ( "bytes" "encoding/json" "fmt" + "github.com/philips-software/go-hsdp-api/internal" "io" "io/ioutil" "net/http" @@ -21,9 +22,8 @@ import ( ) const ( - libraryVersion = "0.29.0" - userAgent = "go-hsdp-api/audit/" + libraryVersion - APIVersion = "2" + userAgent = "go-hsdp-api/audit/" + internal.LibraryVersion + APIVersion = "2" ) // OptionFunc is the function signature function for options diff --git a/cartel/client.go b/cartel/client.go index 17a4d580..0afd6d4f 100644 --- a/cartel/client.go +++ b/cartel/client.go @@ -9,6 +9,7 @@ import ( "encoding/base64" "encoding/json" "fmt" + "github.com/philips-software/go-hsdp-api/internal" "io" "io/ioutil" "net/http" @@ -23,8 +24,7 @@ import ( ) const ( - libraryVersion = "0.29.0" - userAgent = "go-hsdp-api/cartel/" + libraryVersion + userAgent = "go-hsdp-api/cartel/" + internal.LibraryVersion ) // Config the client diff --git a/cdr/client.go b/cdr/client.go index 915e5bfc..dcd82ec8 100644 --- a/cdr/client.go +++ b/cdr/client.go @@ -5,6 +5,7 @@ import ( "bytes" "encoding/json" "fmt" + "github.com/philips-software/go-hsdp-api/internal" "io" "io/ioutil" "net/http" @@ -19,9 +20,8 @@ import ( ) const ( - libraryVersion = "0.29.0" - userAgent = "go-hsdp-api/cdr/" + libraryVersion - APIVersion = "1" + userAgent = "go-hsdp-api/cdr/" + internal.LibraryVersion + APIVersion = "1" ) // OptionFunc is the function signature function for options diff --git a/console/client.go b/console/client.go index aad8b871..ed1ad45b 100644 --- a/console/client.go +++ b/console/client.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/philips-software/go-hsdp-api/internal" "io" "io/ioutil" "net/http" @@ -26,8 +27,7 @@ type tokenType int type ContextKey string const ( - libraryVersion = "0.29.0" - userAgent = "go-hsdp-api/console/" + libraryVersion + userAgent = "go-hsdp-api/console/" + internal.LibraryVersion ) type tokenResponse struct { diff --git a/has/client.go b/has/client.go index 8e244ad3..6752ecd6 100644 --- a/has/client.go +++ b/has/client.go @@ -5,6 +5,7 @@ import ( "bytes" "encoding/json" "fmt" + "github.com/philips-software/go-hsdp-api/internal" "io" "io/ioutil" "net/http" @@ -19,8 +20,7 @@ import ( ) const ( - libraryVersion = "0.29.0" - userAgent = "go-hsdp-api/has/" + libraryVersion + userAgent = "go-hsdp-api/has/" + internal.LibraryVersion ) // OptionFunc is the function signature function for options @@ -86,7 +86,7 @@ func newClient(iamClient *iam.Client, config *Config) (*Client, error) { // Close releases allocated resources of clients func (c *Client) Close() { if c.debugFile != nil { - c.debugFile.Close() + _ = c.debugFile.Close() c.debugFile = nil } } diff --git a/iam/client.go b/iam/client.go index 77d70ef0..ab482876 100644 --- a/iam/client.go +++ b/iam/client.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/philips-software/go-hsdp-api/internal" "io" "io/ioutil" "net/http" @@ -28,8 +29,7 @@ type tokenType int type ContextKey string const ( - libraryVersion = "0.29.0" - userAgent = "go-hsdp-api/iam/" + libraryVersion + userAgent = "go-hsdp-api/iam/" + internal.LibraryVersion loginAPIVersion = "2" ) diff --git a/internal/version.go b/internal/version.go new file mode 100644 index 00000000..6b6d7676 --- /dev/null +++ b/internal/version.go @@ -0,0 +1,5 @@ +package internal + +const ( + LibraryVersion = "0.33.0" +) diff --git a/internal/version_test.go b/internal/version_test.go new file mode 100644 index 00000000..028ab926 --- /dev/null +++ b/internal/version_test.go @@ -0,0 +1,11 @@ +package internal_test + +import ( + "github.com/philips-software/go-hsdp-api/internal" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestVersion(t *testing.T) { + assert.True(t, len(internal.LibraryVersion) > 0) +} diff --git a/iron/client.go b/iron/client.go index 4241dcfe..dc147fda 100644 --- a/iron/client.go +++ b/iron/client.go @@ -5,6 +5,7 @@ import ( "bytes" "encoding/json" "fmt" + "github.com/philips-software/go-hsdp-api/internal" "io" "io/ioutil" "net/http" @@ -17,9 +18,8 @@ import ( ) const ( - libraryVersion = "0.20.1" - userAgent = "go-hsdp-api/iron/" + libraryVersion - IronBaseURL = "https://worker-aws-us-east-1.iron.io/" + userAgent = "go-hsdp-api/iron/" + internal.LibraryVersion + IronBaseURL = "https://worker-aws-us-east-1.iron.io/" ) // OptionFunc is the function signature function for options diff --git a/logging/client.go b/logging/client.go index 65452633..ef612a90 100644 --- a/logging/client.go +++ b/logging/client.go @@ -6,6 +6,7 @@ import ( "encoding/base64" "encoding/json" "fmt" + "github.com/philips-software/go-hsdp-api/internal" "io" "io/ioutil" "net/http" @@ -29,8 +30,7 @@ const ( // TimeFormat is the time format used for the LogTime field TimeFormat = "2006-01-02T15:04:05.000Z07:00" - libraryVersion = "0.29.0" - userAgent = "go-hsdp-api/logging/" + libraryVersion + userAgent = "go-hsdp-api/logging/" + internal.LibraryVersion ) var ( diff --git a/pki/client.go b/pki/client.go index 728588b0..cbd74f51 100644 --- a/pki/client.go +++ b/pki/client.go @@ -5,6 +5,7 @@ import ( "bytes" "encoding/json" "fmt" + "github.com/philips-software/go-hsdp-api/internal" "io" "io/ioutil" "net/http" @@ -26,9 +27,8 @@ import ( ) const ( - libraryVersion = "0.29.0" - userAgent = "go-hsdp-api/pki/" + libraryVersion - APIVersion = "1" + userAgent = "go-hsdp-api/pki/" + internal.LibraryVersion + APIVersion = "1" ) // OptionFunc is the function signature function for options diff --git a/tdr/client.go b/tdr/client.go index 19dbfd85..74a005a5 100644 --- a/tdr/client.go +++ b/tdr/client.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/philips-software/go-hsdp-api/internal" "io" "io/ioutil" "net/http" @@ -20,8 +21,7 @@ import ( ) const ( - libraryVersion = "0.29.0" - userAgent = "go-hsdp-api/tdr/" + libraryVersion + userAgent = "go-hsdp-api/tdr/" + internal.LibraryVersion ) // OptionFunc is the function signature function for options @@ -83,7 +83,7 @@ func newClient(iamClient *iam.Client, config *Config) (*Client, error) { // Close releases allocated resources of clients func (c *Client) Close() { if c.debugFile != nil { - c.debugFile.Close() + _ = c.debugFile.Close() c.debugFile = nil } } diff --git a/tpns/client.go b/tpns/client.go index d00f7418..68e7c57a 100644 --- a/tpns/client.go +++ b/tpns/client.go @@ -5,6 +5,7 @@ import ( "bytes" "encoding/json" "fmt" + "github.com/philips-software/go-hsdp-api/internal" "io" "io/ioutil" "net/http" @@ -17,8 +18,7 @@ import ( ) const ( - libraryVersion = "0.1.0" - userAgent = "go-hsdp-api/tpns/" + libraryVersion + userAgent = "go-hsdp-api/tpns/" + internal.LibraryVersion tpnsAPIVersion = "2" )