mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
go vet yourself (#397)
go vet caught some nifty bugs. so fixed those here, and also made it so that we vet everything from now on since the robots seem to do a better job of vetting than we have managed to. also adds gofmt check to circle. could move this to the test.sh script (didn't want a script calling a script, because $reasons) and it's nice and isolated in its own little land as it is. side note, changed the script so it runs in 100ms instead of 3s, i think find is a lot faster than go list. attempted some minor cleanup of various scripts
This commit is contained in:
committed by
Travis Reeder
parent
d16d449626
commit
8a59654582
@@ -112,6 +112,6 @@ func TestRegistry(t *testing.T) {
|
||||
}
|
||||
|
||||
if size <= 0 {
|
||||
t.Fatalf("expected positive size for image that exists, got size:", size)
|
||||
t.Fatal("expected positive size for image that exists, got size:", size)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ func (l *limitWriter) Write(b []byte) (int, error) {
|
||||
l.n += n
|
||||
if l.n >= l.max {
|
||||
// write in truncation message to log once
|
||||
l.Writer.Write([]byte(fmt.Sprintf("\n-----max log size %d bytes exceeded, truncating log-----\n")))
|
||||
l.Writer.Write([]byte(fmt.Sprintf("\n-----max log size %d bytes exceeded, truncating log-----\n", l.max)))
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ func Test(t *testing.T, dsf func() models.Datastore) {
|
||||
t.Fatalf("Test GetCalls(ctx, filter): unexpected length `%v`", len(calls))
|
||||
} else if calls[0].ID != c2.ID {
|
||||
t.Log(buf.String())
|
||||
t.Fatalf("Test GetCalls: call id not expected", calls[0].ID, c2.ID)
|
||||
t.Fatalf("Test GetCalls: call id not expected %s vs %s", calls[0].ID, c2.ID)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -387,7 +387,7 @@ func Test(t *testing.T, dsf func() models.Datastore) {
|
||||
_, err := ds.InsertApp(ctx, testApp)
|
||||
if err != nil && err != models.ErrAppsAlreadyExists {
|
||||
t.Log(buf.String())
|
||||
t.Fatalf("Test InsertRoute Prep: failed to insert app: ", err)
|
||||
t.Fatal("Test InsertRoute Prep: failed to insert app: ", err)
|
||||
}
|
||||
|
||||
// Testing insert route
|
||||
|
||||
@@ -26,10 +26,10 @@ func SetMachineId(id uint64) {
|
||||
// with an addition that net.IP must be a ipv4 address.
|
||||
func SetMachineIdHost(addr net.IP, port uint16) {
|
||||
var machineId uint64 // 48 bits
|
||||
machineId |= uint64(addr[0] << 40)
|
||||
machineId |= uint64(addr[1] << 32)
|
||||
machineId |= uint64(addr[2] << 24)
|
||||
machineId |= uint64(addr[3] << 16)
|
||||
machineId |= uint64(addr[0]) << 40
|
||||
machineId |= uint64(addr[1]) << 32
|
||||
machineId |= uint64(addr[2]) << 24
|
||||
machineId |= uint64(addr[3]) << 16
|
||||
machineId |= uint64(port)
|
||||
|
||||
SetMachineId(machineId)
|
||||
|
||||
@@ -27,7 +27,7 @@ type Route struct {
|
||||
Memory uint64 `json:"memory" db:"memory"`
|
||||
Headers Headers `json:"headers" db:"headers"`
|
||||
Type string `json:"type" db:"type"`
|
||||
Format string `json:"format" db":format"`
|
||||
Format string `json:"format" db:"format"`
|
||||
Timeout int32 `json:"timeout" db:"timeout"`
|
||||
IdleTimeout int32 `json:"idle_timeout" db:"idle_timeout"`
|
||||
Config Config `json:"config" db:"config"`
|
||||
|
||||
@@ -109,7 +109,7 @@ func traceWrap(c *gin.Context) {
|
||||
// Create the span referring to the RPC client if available.
|
||||
// If wireContext == nil, a root span will be created.
|
||||
// TODO we should add more tags?
|
||||
serverSpan := opentracing.StartSpan("serve_http", ext.RPCServerOption(wireContext), opentracing.Tag{"path", c.Request.URL.Path})
|
||||
serverSpan := opentracing.StartSpan("serve_http", ext.RPCServerOption(wireContext), opentracing.Tag{Key: "path", Value: c.Request.URL.Path})
|
||||
defer serverSpan.Finish()
|
||||
|
||||
ctx := opentracing.ContextWithSpan(c.Request.Context(), serverSpan)
|
||||
|
||||
Reference in New Issue
Block a user