Skip to content

Commit

Permalink
reduce types scope, to private
Browse files Browse the repository at this point in the history
  • Loading branch information
obanby committed Oct 15, 2024
1 parent eb79f3c commit ecb96cc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions pkg/sigv4/sigv4.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@ import (
"time"
)

type Signer interface {
Sign(req *http.Request) error
type signer interface {
sign(req *http.Request) error
}

type DefaultSigner struct {
type defaultSigner struct {
config *Config

// noEscape represents the characters that AWS doesn't escape
noEscape [256]bool
}

func NewDefaultSigner(config *Config) Signer {
ds := &DefaultSigner{
func newDefaultSigner(config *Config) signer {
ds := &defaultSigner{
config: config,
noEscape: buildAwsNoEscape(),
}

return ds
}

func (d *DefaultSigner) Sign(req *http.Request) error {
func (d *defaultSigner) sign(req *http.Request) error {
now := time.Now().UTC()
iSO8601Date := now.Format(timeFormat)

Expand Down Expand Up @@ -81,7 +81,7 @@ func (d *DefaultSigner) Sign(req *http.Request) error {
return nil
}

func (d *DefaultSigner) getPayloadHash(req *http.Request) (string, error) {
func (d *defaultSigner) getPayloadHash(req *http.Request) (string, error) {
if req.Body == nil {
return emptyStringSHA256, nil
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/sigv4/tripper.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

type Tripper struct {

Check warning on line 9 in pkg/sigv4/tripper.go

View workflow job for this annotation

GitHub Actions / checks / lint

exported: exported type Tripper should have comment or be unexported (revive)
config *Config
signer Signer
signer signer
next http.RoundTripper
}

Expand Down Expand Up @@ -42,13 +42,13 @@ func NewRoundTripper(config *Config, next http.RoundTripper) (*Tripper, error) {
tripper := &Tripper{
config: config,
next: next,
signer: NewDefaultSigner(config),
signer: newDefaultSigner(config),
}
return tripper, nil
}

func (c *Tripper) RoundTrip(req *http.Request) (*http.Response, error) {

Check warning on line 50 in pkg/sigv4/tripper.go

View workflow job for this annotation

GitHub Actions / checks / lint

exported: exported method Tripper.RoundTrip should have comment or be unexported (revive)
if err := c.signer.Sign(req); err != nil {
if err := c.signer.sign(req); err != nil {
return nil, err
}
return c.next.RoundTrip(req)
Expand Down

0 comments on commit ecb96cc

Please sign in to comment.