Skip to content

Commit 09e11d3

Browse files
committed
Resolved linter warnings
1 parent fe64c1d commit 09e11d3

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/structs.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,14 @@ func (m wsError) Error() string {
3737
return m.Msg
3838
}
3939

40-
func newWSError(reqIdx int, code int, msg string, elements ...interface{}) wsError {
40+
func newWSErrorf(reqIdx int, code int, msg string, elements ...interface{}) wsError {
4141
return wsError{reqIdx, fmt.Sprintf(msg, elements...), code}
4242
}
4343

44+
func newWSError(reqIdx int, code int, msg string) wsError {
45+
return wsError{reqIdx, msg, code}
46+
}
47+
4448
// These are for parsing the config file (from YAML)
4549
// and storing additional context
4650

src/web_service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,14 @@ func handler(databaseId string) func(c *fiber.Ctx) error {
196196
return func(c *fiber.Ctx) error {
197197
var body request
198198
if err := c.BodyParser(&body); err != nil {
199-
return newWSError(-1, fiber.StatusBadRequest, "in parsing body: %s", err.Error())
199+
return newWSErrorf(-1, fiber.StatusBadRequest, "in parsing body: %s", err.Error())
200200
}
201201

202202
isListResultSet := body.ResultFormat != nil && strings.EqualFold(*body.ResultFormat, "list")
203203

204204
db, found := dbs[databaseId]
205205
if !found {
206-
return newWSError(-1, fiber.StatusNotFound, "database with ID '%s' not found", databaseId)
206+
return newWSErrorf(-1, fiber.StatusNotFound, "database with ID '%s' not found", databaseId)
207207
}
208208

209209
// Execute non-concurrently

src/ws4sqlite.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ const version = "v0.0.0"
4040

4141
func getSQLiteVersion() (string, error) {
4242
dbObj, err := sql.Open("sqlite", ":memory:")
43-
defer dbObj.Close()
4443
if err != nil {
4544
return "", err
4645
}
46+
defer dbObj.Close()
4747
row := dbObj.QueryRow("SELECT sqlite_version()")
4848
var ver string
4949
err = row.Scan(&ver)

0 commit comments

Comments
 (0)