diff --git a/Makefile b/Makefile index 2b5dad04..8d60cf52 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,10 @@ run: build fmt: $(GOFILES) gofmt -w -s $(GOFILES) +spell: $(GOFILES) + misspell $(GOFILES) + + myday: test lint vet COMPLETER_DIR := $(realpath $(dir $(firstword $(MAKEFILE_LIST)))) diff --git a/graph/graph.go b/graph/graph.go index a6628fa2..188cb9fb 100644 --- a/graph/graph.go +++ b/graph/graph.go @@ -110,7 +110,7 @@ func (graph *CompletionGraph) IsCompleted() bool { } // HandleCompleted closes the graph for modifications -// this should only be called once an OnComplete event has been emmitted by the graph +// this should only be called once an OnComplete event has been emitted by the graph func (graph *CompletionGraph) handleCompleted() { graph.log.Info("completing graph") graph.state = StateCompleted diff --git a/graph/stage.go b/graph/stage.go index 2e4228ca..cd699288 100644 --- a/graph/stage.go +++ b/graph/stage.go @@ -55,7 +55,7 @@ func (r *RawDependency) GetID() string { return r.ID } -// GetResult gets the result (or nil if no result) of teh graph +// GetResult gets the result (or nil if no result) of the graph func (r *RawDependency) GetResult() *model.CompletionResult { return r.result } @@ -85,7 +85,7 @@ func (stage *CompletionStage) GetID() string { return stage.ID } -// GetResult gets the result (or nil if no result) of teh graph +// GetResult gets the result (or nil if no result) of the graph func (stage *CompletionStage) GetResult() *model.CompletionResult { return stage.result } diff --git a/graph/stage_strategy.go b/graph/stage_strategy.go index 04b718be..fb168692 100644 --- a/graph/stage_strategy.go +++ b/graph/stage_strategy.go @@ -86,7 +86,7 @@ func invokeWithResult(stage *CompletionStage, listener CompletionEventListener, listener.OnExecuteStage(stage, results) } -// invokeWithResultOrError triggers invoking the closure with a pair consisting of the (result,) if the result is successful, or (,error) if the result is an error +// invokeWithResultOrError triggers invoking the closure with a pair consisting of the (result,) if the result is successful, or (,error) if the result is an error // this can only be used with single-valued result func invokeWithResultOrError(stage *CompletionStage, listener CompletionEventListener, results []*model.CompletionResult) { if len(results) != 1 { diff --git a/persistence/sql_blob_store_test.go b/persistence/sql_blob_store_test.go index c12f4054..00464c41 100644 --- a/persistence/sql_blob_store_test.go +++ b/persistence/sql_blob_store_test.go @@ -67,7 +67,7 @@ func givenEmptyBlobStore() BlobStore { func setupDb() *sqlx.DB { resetTestDb() - db, err := CreateDBConnecection(testDbURL()) + db, err := CreateDBConnection(testDbURL()) if err != nil { panic(err) } diff --git a/persistence/sql_init.go b/persistence/sql_init.go index eb3cab96..629b8868 100644 --- a/persistence/sql_init.go +++ b/persistence/sql_init.go @@ -30,8 +30,8 @@ var tables = [...]string{`CREATE TABLE IF NOT EXISTS events ( blob_data BLOB);`, } -// CreateDBConnecection sets up a DB connection and ensures required tables exist -func CreateDBConnecection(url *url.URL) (*sqlx.DB, error) { +// CreateDBConnection sets up a DB connection and ensures required tables exist +func CreateDBConnection(url *url.URL) (*sqlx.DB, error) { driver := url.Scheme switch driver { case "mysql", "sqlite3": diff --git a/persistence/sql_provider_test.go b/persistence/sql_provider_test.go index ba5d27b0..a99e1dc9 100644 --- a/persistence/sql_provider_test.go +++ b/persistence/sql_provider_test.go @@ -106,7 +106,7 @@ func getEventsForActor(provider ProviderState, actorName string, startIdx int) [ func givenProvider(t *testing.T) ProviderState { resetTestDb() - db, err := CreateDBConnecection(testDbURL()) + db, err := CreateDBConnection(testDbURL()) require.NoError(t, err) provider, err := NewSQLProvider(db, 0) require.NoError(t, err) diff --git a/protocol/read_test.go b/protocol/read_test.go index 526e9fae..009ca859 100644 --- a/protocol/read_test.go +++ b/protocol/read_test.go @@ -347,13 +347,14 @@ func TestReadsSuccessfulEncapsulatedResultFromHttpResp(t *testing.T) { val, err := store.ReadBlobData(result.Datum.GetBlob()) + require.NoError(t, err) assert.True(t, result.Successful) assert.Equal(t, content, val) assert.Equal(t, "text/plain", result.Datum.GetBlob().ContentType) } -func TestReadsFailedncapsulatedResultFromHttpResp(t *testing.T) { +func TestReadsFailedEncapsulatedResultFromHTTPResp(t *testing.T) { store := persistence.NewInMemBlobStore() h := http.Header{} @@ -386,13 +387,14 @@ func TestReadsFailedncapsulatedResultFromHttpResp(t *testing.T) { val, err := store.ReadBlobData(result.Datum.GetBlob()) + require.NoError(t, err) assert.False(t, result.Successful) assert.Equal(t, content, val) assert.Equal(t, "text/plain", result.Datum.GetBlob().ContentType) } -func TestRejectsHttpRespDatumWithNoResultCode(t *testing.T) { +func TestRejectsHTTPRespDatumWithNoResultCode(t *testing.T) { store := persistence.NewInMemBlobStore() h := emptyHeaders() @@ -408,7 +410,7 @@ func TestRejectsHttpRespDatumWithNoResultCode(t *testing.T) { assert.Equal(t, ErrMissingResultCode, err) } -func TestRejectsHttpReqDatumWithInvalidResultCode(t *testing.T) { +func TestRejectsHTTPReqDatumWithInvalidResultCode(t *testing.T) { store := persistence.NewInMemBlobStore() h := emptyHeaders() diff --git a/setup/setup.go b/setup/setup.go index a405bd84..8813c489 100644 --- a/setup/setup.go +++ b/setup/setup.go @@ -133,7 +133,7 @@ func initStorageFromEnv() (persistence.ProviderState, persistence.BlobStore, err return persistence.NewInMemoryProvider(snapshotInterval), persistence.NewInMemBlobStore(), nil } - dbConn, err := persistence.CreateDBConnecection(dbURL) + dbConn, err := persistence.CreateDBConnection(dbURL) if err != nil { return nil, nil, err }