Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remaining linter issues #84

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions internal/openai/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ const (

type ClientLoadFn func(opts ...client.Option) client.Client

var DefaultClientLoader ClientLoadFn = func(opts ...client.Option) client.Client {
return client.New(opts...)
}
var DefaultClientLoader ClientLoadFn = client.New

func Plugin(version string, loader ClientLoadFn) *plugin.Schema {
if loader == nil {
Expand Down
4 changes: 1 addition & 3 deletions parser/definitions/title.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ func (t *TitleInvocation) GetBody() *hclsyntax.Body {
}

// SetBody implements evaluation.Invocation.
func (*TitleInvocation) SetBody(*hclsyntax.Body) {
return
}
func (*TitleInvocation) SetBody(*hclsyntax.Body) {}

var _ evaluation.Invocation = (*TitleInvocation)(nil)

Expand Down
11 changes: 5 additions & 6 deletions parser/evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ func (e *Evaluator) EvaluateDocument(d *definitions.Document) (results []string,

results = make([]string, 0, len(e.contentCalls))
for _, call := range e.contentCalls {
context, diag := e.evaluateQuery(call)
if diags.Extend(diag) {
// query failed, but context is always valid
// TODO: #28 #29
}
context, _ := e.evaluateQuery(call)
// if diags.Extend(diag) {
// query failed, but context is always valid
// TODO: #28 #29
// }
result, diag := e.caller.CallContent(call.PluginName, call.Config, call.Invocation, context)
if diags.Extend(diag) {
// XXX: What to do if we have errors while executing content blocks?
Expand Down Expand Up @@ -249,5 +249,4 @@ func (e *Evaluator) evaluateSection(s *definitions.ParsedSection) {
panic("must be exhaustive")
}
}
return
}
1 change: 1 addition & 0 deletions parser/parseSectionBlock.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func (db *DefinedBlocks) parseSection(section *definitions.Section) (parsed *def
continue
}
circularRefDetector.Add(section, block.DefRange().Ptr())
//nolint:gocritic
defer circularRefDetector.Remove(section, &diags)
parsedSubSection, diag := db.ParseSection(subSection)
if diags.Extend(diag) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cirularRefDetector/circularRefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ func (d *circularRefDetector) remove(ptr unsafe.Pointer, diags *diagnostics.Diag
diag.Detail, rng.Filename, rng.Start.Line, rng.Start.Column,
)
} else {
diag.Detail = diag.Detail + "\n at <missing location info>"
diag.Detail += "\n at <missing location info>"
}
}
2 changes: 1 addition & 1 deletion pkg/diagnostics/diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/hashicorp/hcl/v2"
)

type Diag hcl.Diagnostics //nolint:errname // Diagnostics does implement error interface, but not, itself, an error.
type Diag hcl.Diagnostics // Diagnostics does implement error interface, but not, itself, an error.

type repeatedError struct{}

Expand Down
2 changes: 1 addition & 1 deletion pkg/jsontools/jsontools.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ func UnmarshalBytes(bytes, value any) error {
if !ok {
return ErrUnmarshalBytes
}
return json.Unmarshal(data, value) //nolint: wrapcheck
return json.Unmarshal(data, value)
}
2 changes: 1 addition & 1 deletion pkg/parexec/limiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
var NoLimit = (*Limiter)(nil)

// DiskIOLimiter is a shared limiter for all Disk IO tasks.
var DiskIOLimiter = NewLimiter(4) //nolint: gomnd
var DiskIOLimiter = NewLimiter(4)

// CPULimiter is a shared limiter for all CPU-bound tasks.
var CPULimiter = NewLimiter(2 * runtime.NumCPU())
Expand Down
Loading