Skip to content

Commit

Permalink
Merge pull request #125 from mattn/fix-golangci-lint
Browse files Browse the repository at this point in the history
update workflows
  • Loading branch information
mattn authored Dec 29, 2023
2 parents 463a040 + beb3ae0 commit 67939e8
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ jobs:
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.45.2
version: v1.54
- name: Test
run: go test -coverprofile coverage.out -covermode atomic ./...
4 changes: 2 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package config
import (
"errors"
"fmt"
"io/ioutil"
"io"
"os"
"path/filepath"

Expand Down Expand Up @@ -68,7 +68,7 @@ func (c *Config) Load(fp string) error {
}
defer file.Close()

b, err := ioutil.ReadAll(file)
b, err := io.ReadAll(file)
if err != nil {
return fmt.Errorf("cannot read config, %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/database/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package database
import (
"errors"
"fmt"
"io/ioutil"
"os"

"github.com/sqls-server/sqls/dialect"
"golang.org/x/crypto/ssh"
Expand Down Expand Up @@ -143,7 +143,7 @@ func (s *SSHConfig) Endpoint() string {
}

func (s *SSHConfig) ClientConfig() (*ssh.ClientConfig, error) {
buffer, err := ioutil.ReadFile(s.PrivateKey)
buffer, err := os.ReadFile(s.PrivateKey)
if err != nil {
return nil, fmt.Errorf("cannot read SSH private key file, PrivateKey=%s, %w", s.PrivateKey, err)
}
Expand Down
7 changes: 3 additions & 4 deletions internal/handler/format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package handler

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -186,7 +185,7 @@ func loadFormatTestCaseByTestdata(targetDir string) ([]formattingTestCase, error
return nil, err
}
testDir := filepath.Join(packageDir, "testdata", targetDir)
testFileInfos, err := ioutil.ReadDir(testDir)
testFileInfos, err := os.ReadDir(testDir)
if err != nil {
return nil, err
}
Expand All @@ -207,11 +206,11 @@ func loadFormatTestCaseByTestdata(targetDir string) ([]formattingTestCase, error
inputPath := filepath.Join(testDir, inputFileName)
goldenPath := filepath.Join(testDir, testName+goldenFileSuffix)

input, err := ioutil.ReadFile(inputPath)
input, err := os.ReadFile(inputPath)
if err != nil {
return nil, fmt.Errorf("Cannot read input file, Path=%s, Err=%+v", inputPath, err)
}
golden, err := ioutil.ReadFile(goldenPath)
golden, err := os.ReadFile(goldenPath)
if err != nil {
return nil, fmt.Errorf("Cannot read input file, Path=%s, Err=%+v", goldenPath, err)
}
Expand Down
2 changes: 2 additions & 0 deletions internal/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ func (s *Server) handle(ctx context.Context, conn *jsonrpc2.Conn, req *jsonrpc2.
return s.handleDefinition(ctx, conn, req)
case "textDocument/typeDefinition":
return s.handleDefinition(ctx, conn, req)
case "window/showMessage":
return
}
return nil, &jsonrpc2.Error{Code: jsonrpc2.CodeMethodNotFound, Message: fmt.Sprintf("method not supported: %s", req.Method)}
}
Expand Down
5 changes: 4 additions & 1 deletion internal/handler/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package handler

import (
"context"
"errors"
"log"
"net"
"reflect"
Expand Down Expand Up @@ -48,7 +49,9 @@ func (tx *TestContext) tearDown() {

if tx.connServer != nil {
if err := tx.connServer.Close(); err != nil {
log.Fatal("connServer.Close:", err)
if !errors.Is(err, jsonrpc2.ErrClosed) {
log.Fatal("connServer.Close:", err)
}
}
}
}
Expand Down

0 comments on commit 67939e8

Please sign in to comment.