Skip to content

Commit 3d70ea6

Browse files
Fixed golang-ci warnings
1 parent d90308d commit 3d70ea6

5 files changed

Lines changed: 7 additions & 9 deletions

File tree

examples/embedded_files/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"embed"
55
"fmt"
6+
67
sqlTemplate "github.com/NicklasWallgren/sqlTemplate/pkg"
78
)
89

examples/map_as_param/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ package main
22

33
import (
44
"fmt"
5-
sqlTemplate "github.com/NicklasWallgren/sqlTemplate/pkg"
65
"os"
6+
7+
sqlTemplate "github.com/NicklasWallgren/sqlTemplate/pkg"
78
)
89

910
func main() {

pkg/template_engine.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ type QueryTemplate interface {
3030
type Option func(*queryTemplateEngine)
3131

3232
type queryTemplateEngine struct {
33-
data interface{}
3433
repository *repository
3534
}
3635

pkg/template_engine_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,13 @@ func TestNewQueryTemplateEngine_WithTemplateFunctions(t *testing.T) {
1414
}
1515

1616
func TestQueryTemplateEngine_Register(t *testing.T) {
17-
1817
}
1918

2019
func TestQueryTemplateEngine_Parse(t *testing.T) {
21-
2220
}
2321

2422
func TestQueryTemplateEngine_ParseWithValuesFromMap(t *testing.T) {
25-
2623
}
2724

2825
func TestQueryTemplateEngine_ParseWithValuesFromStruct(t *testing.T) {
29-
3026
}

pkg/template_repository.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type bindings struct {
2222
// bind stores the given `value` and returns a placeholder parameter.
2323
func (b *bindings) bind(value interface{}) string {
2424
b.values = append(b.values, value)
25+
2526
return "?"
2627
}
2728

@@ -45,7 +46,7 @@ func (r *repository) addFunctions(functions template.FuncMap) {
4546
}
4647
}
4748

48-
// add walks a filesystem and parses the corresponding templates
49+
// add walks a filesystem and parses the corresponding templates.
4950
func (r *repository) add(namespace string, filesystem fs.FS, extension string) (err error) {
5051
filesInFilesystem, err := getFilesInFilesystem(filesystem, extension)
5152
if err != nil {
@@ -82,6 +83,7 @@ func (r *repository) parse(namespace string, name string, data interface{}) (str
8283

8384
// Apply the bind function which stores the values for any placeholder parameters
8485
values := &bindings{values: []interface{}{}}
86+
8587
clonedTmpl.Funcs(template.FuncMap{"bind": values.bind})
8688

8789
var b bytes.Buffer
@@ -92,7 +94,7 @@ func (r *repository) parse(namespace string, name string, data interface{}) (str
9294
return b.String(), values.values, nil
9395
}
9496

95-
// bind is a dummy function which is never used while executing a template
97+
// bind is a dummy function which is never used while executing a template.
9698
func bind(param interface{}) string {
9799
return "?"
98100
}
@@ -108,7 +110,6 @@ func getFilesInFilesystem(filesystem fs.FS, extension string) ([]string, error)
108110

109111
return nil
110112
})
111-
112113
if err != nil {
113114
return nil, fmt.Errorf("unable to retrieve files in directory %w", err)
114115
}

0 commit comments

Comments
 (0)