Skip to content

Commit

Permalink
Move version to internal package
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Lo-A-Foe <[email protected]>
  • Loading branch information
loafoe committed Jan 27, 2021
1 parent 48f5802 commit be15b03
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 28 deletions.
6 changes: 3 additions & 3 deletions audit/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/philips-software/go-hsdp-api/internal"
"io"
"io/ioutil"
"net/http"
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cartel/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"github.com/philips-software/go-hsdp-api/internal"
"io"
"io/ioutil"
"net/http"
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions cdr/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/philips-software/go-hsdp-api/internal"
"io"
"io/ioutil"
"net/http"
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions console/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/philips-software/go-hsdp-api/internal"
"io"
"io/ioutil"
"net/http"
Expand All @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions has/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/philips-software/go-hsdp-api/internal"
"io"
"io/ioutil"
"net/http"
Expand All @@ -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
Expand Down Expand Up @@ -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
}
}
Expand Down
4 changes: 2 additions & 2 deletions iam/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/philips-software/go-hsdp-api/internal"
"io"
"io/ioutil"
"net/http"
Expand All @@ -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"
)

Expand Down
5 changes: 5 additions & 0 deletions internal/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package internal

const (
LibraryVersion = "0.33.0"
)
11 changes: 11 additions & 0 deletions internal/version_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
6 changes: 3 additions & 3 deletions iron/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/philips-software/go-hsdp-api/internal"
"io"
"io/ioutil"
"net/http"
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions logging/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"github.com/philips-software/go-hsdp-api/internal"
"io"
"io/ioutil"
"net/http"
Expand All @@ -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 (
Expand Down
6 changes: 3 additions & 3 deletions pki/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/philips-software/go-hsdp-api/internal"
"io"
"io/ioutil"
"net/http"
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tdr/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/philips-software/go-hsdp-api/internal"
"io"
"io/ioutil"
"net/http"
Expand All @@ -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
Expand Down Expand Up @@ -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
}
}
Expand Down
4 changes: 2 additions & 2 deletions tpns/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/philips-software/go-hsdp-api/internal"
"io"
"io/ioutil"
"net/http"
Expand All @@ -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"
)

Expand Down

0 comments on commit be15b03

Please sign in to comment.