Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Commit

Permalink
refactor: add golang staticcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
donch1989 committed Jan 12, 2024
1 parent 792559e commit 963fca8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/staticcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Staticcheck"
on: ["push", "pull_request"]

jobs:
staticcheck:
name: "Run CI"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dominikh/staticcheck-action@v1.2.0
with:
version: "2022.1.1"
6 changes: 3 additions & 3 deletions pkg/base/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"google.golang.org/protobuf/types/known/structpb"
)

const conditionJson = `
const conditionJSON = `
{
"type": "string",
"instillUIOrder": 1,
Expand Down Expand Up @@ -247,7 +247,7 @@ func (comp *Component) generateComponentSpec(title string, availableTasks []stri
}

condition := &structpb.Struct{}
err = protojson.Unmarshal([]byte(conditionJson), condition)
err = protojson.Unmarshal([]byte(conditionJSON), condition)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -555,7 +555,7 @@ func ConvertToStructpb(from interface{}) (*structpb.Struct, error) {
return to, nil
}

func renderTaskJson(tasksJSONBytes []byte, additionalJSONBytes map[string][]byte) ([]byte, error) {
func renderTaskJSON(tasksJSONBytes []byte, additionalJSONBytes map[string][]byte) ([]byte, error) {
var err error
mp := provider.NewMap()
for k, v := range additionalJSONBytes {
Expand Down
2 changes: 1 addition & 1 deletion pkg/base/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (c *Connector) LoadConnectorDefinitions(definitionsJSONBytes []byte, tasksJ
if err != nil {
return err
}
renderedTasksJSON, nil := renderTaskJson(tasksJSONBytes, additionalJSONBytes)
renderedTasksJSON, nil := renderTaskJSON(tasksJSONBytes, additionalJSONBytes)
if err != nil {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/base/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (o *Operator) LoadOperatorDefinitions(definitionsJSONBytes []byte, tasksJSO
if err != nil {
return err
}
renderedTasksJSON, nil := renderTaskJson(tasksJSONBytes, additionalJSONBytes)
renderedTasksJSON, nil := renderTaskJSON(tasksJSONBytes, additionalJSONBytes)
if err != nil {
return nil
}
Expand Down
1 change: 1 addition & 0 deletions staticcheck.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
checks = ["all"]

0 comments on commit 963fca8

Please sign in to comment.