Skip to content

Commit

Permalink
nobug: fix gofmt formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bubbajoe committed Apr 14, 2024
1 parent 8fa7f2c commit 4c8a4c4
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 26 deletions.
6 changes: 3 additions & 3 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ type (

DGateJWTAuthConfig struct {
// HeaderName is the name of the header to extract the JWT token from
HeaderName string `koanf:"header_name"`
Algorithm string `koanf:"algorithm"`
SignatureConfig map[string]any `koanf:",remain"`
HeaderName string `koanf:"header_name"`
Algorithm string `koanf:"algorithm"`
SignatureConfig map[string]any `koanf:",remain"`
}

AsymmetricSignatureConfig struct {
Expand Down
1 change: 0 additions & 1 deletion internal/config/configtest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,3 @@ func NewTest2DGateConfig() *config.DGateConfig {
},
}
}

2 changes: 1 addition & 1 deletion internal/config/store_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ func StoreConfig[T any, C any](config C) (T, error) {
}
err = decoder.Decode(config)
return output, err
}
}
2 changes: 1 addition & 1 deletion internal/pattern/pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func PatternMatch(value, pattern string) (bool, error) {
return strings.Contains(value, pattern[1:len(pattern)-1]), nil
} else if asteriskPrefix {
return strings.HasSuffix(value, pattern[1:]), nil
} else if asteriskSuffix{
} else if asteriskSuffix {
return strings.HasPrefix(value, pattern[:len(pattern)-1]), nil
} else if strings.HasPrefix(pattern, "/") && strings.HasSuffix(pattern, "/") {
re := pattern[1 : len(pattern)-1]
Expand Down
10 changes: 5 additions & 5 deletions internal/proxy/proxy_transport/proxy_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ func (b *proxyTransportBuilder) RetryTimeout(retryTimeout time.Duration) Builder

func (b *proxyTransportBuilder) Clone() Builder {
return &proxyTransportBuilder{
transport: b.transport,
transport: b.transport,
requestTimeout: b.requestTimeout,
retries: b.retries,
retryTimeout: b.requestTimeout,
retries: b.retries,
retryTimeout: b.requestTimeout,
}
}

Expand Down Expand Up @@ -101,8 +101,8 @@ func (m *retryRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)
return m.transport.RoundTrip(req)
}
var (
resp *http.Response
err error
resp *http.Response
err error
// retryTimeoutChan <-chan time.Time
)
// if m.retryTimeout != 0 {
Expand Down
1 change: 0 additions & 1 deletion pkg/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ func TestCache_MaxItems_Overwrite(t *testing.T) {
assert.True(t, ok, "expected key to be found")
assert.Equal(t, 1, n, "expected value to be 1, got %d", n)


c.Bucket("test").SetWithTTL("key", 2, time.Millisecond*100)
n, ok = c.Bucket("test").Get("key")
assert.True(t, ok, "expected key to be found")
Expand Down
4 changes: 2 additions & 2 deletions pkg/modules/extractors/extractors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func TestExportedPromiseErrors(t *testing.T) {
if err != nil {
t.Fatal(err)
}

rt := loop.Start()
defer loop.Stop()

Expand All @@ -208,7 +208,7 @@ func TestExportedPromiseErrors(t *testing.T) {
if err != nil {
t.Fatal(err)
}

callable, ok = goja.AssertFunction(v)
if !assert.True(t, ok) {
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/modules/testutil/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type mockRuntimeContext struct {
mock.Mock
smap *sync.Map
ctx context.Context
req *require.Registry
req *require.Registry
loop *eventloop.EventLoop
data any
state modules.StateManager
Expand Down
1 change: 0 additions & 1 deletion pkg/modules/types/response_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,3 @@ func (g *ResponseWriterWrapper) Cookie() []*http.Cookie {
func (g *ResponseWriterWrapper) Header() http.Header {
return g.rw.Header()
}

2 changes: 1 addition & 1 deletion pkg/resources/resource_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ func BenchmarkRM_ReadingWriting(b *testing.B) {
Paths: []string{"/"},
Methods: []string{"GET"},
Modules: []string{""},
Tags: []string{"test"},
Tags: []string{"test"},
}
for i := 0; pb.Next(); i++ {
rt.Name = "test" + strconv.Itoa(i%routeSize)
Expand Down
4 changes: 2 additions & 2 deletions pkg/spec/response_writer_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ type ResponseWriterTracker interface {
}

type rwTracker struct {
rw http.ResponseWriter
status int
rw http.ResponseWriter
status int
bytesWritten int64
}

Expand Down
1 change: 1 addition & 0 deletions pkg/typescript/typescript.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
)

// typescript v5.3.3
//
//go:embed typescript.min.js
var tscSource string

Expand Down
2 changes: 1 addition & 1 deletion pkg/typescript/typescript_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/dop251/goja"
)

// TOOD: add more test cases for errors to ensure the line numbers are correct
// TODO: add more test cases for errors to ensure the line numbers are correct
// and the error messages are correct; also wrap code in a function and test.

func TestTranspile(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"hash"
"hash/crc32"
)

func jsonHash(objs ...any) (hash.Hash32, error) {
hash, err := crc32Hash(func(a any) []byte {
b, err := json.Marshal(a)
Expand All @@ -29,7 +30,6 @@ func JsonHash(objs ...any) (uint32, error) {
return hash.Sum32(), nil
}


func JsonHashBytes(objs ...any) ([]byte, error) {
hash, err := jsonHash(objs...)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/util/http_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func JsonResponse(w http.ResponseWriter, statusCode int, data any) {
}
responseData := map[string]any{
"status_code": statusCode,
"data": data,
"data": data,
}
if isSlice(data) {
responseData["count"] = sliceLen(data)
Expand All @@ -40,7 +40,7 @@ func JsonError[T any](w http.ResponseWriter, statusCode int, message T) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(statusCode)
json.NewEncoder(w).Encode(map[string]any{
"error": message,
"error": message,
"status": statusCode,
})
}
Expand Down
1 change: 0 additions & 1 deletion pkg/util/linker/linker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func TestLinkerTests(t *testing.T) {
linker3.LinkOneMany("bottom", "l3bottom", linker2)
linker2.LinkOneMany("bottom", "l2bottom", linker1)


assert.True(t, linker1.Len("top") == 1)
assert.True(t, linker2.Len("top") == 1)
assert.True(t, linker3.Len("top") == 1)
Expand Down
4 changes: 2 additions & 2 deletions pkg/util/tree/avl/avl.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ func replace[K cmp.Ordered, V any](root *node[K, V], key K, value V) (*node[K, V
var oldValue V
if root == nil {
return &node[K, V]{
key: key,
val: value,
key: key,
val: value,
height: 1,
}, oldValue
}
Expand Down

0 comments on commit 4c8a4c4

Please sign in to comment.