Skip to content

Commit

Permalink
Merge pull request #6 from janpfeifer/goreportcard
Browse files Browse the repository at this point in the history
Fixed small Go Report Card issues.
  • Loading branch information
janpfeifer authored Mar 8, 2023
2 parents c40c207 + c99c831 commit 0ffd268
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion dispatcher/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func HandleInspectRequest(msg kernel.Message, goExec *goexec.State) error {
func handleCompleteRequest(msg kernel.Message, goExec *goexec.State) (err error) {
log.Printf("`complete_request`:")

// Start with emtpy reply, and makes sure reply is sent at the end.
// Start with empty reply, and makes sure reply is sent at the end.
reply := &kernel.CompleteReply{
Status: "ok",
Matches: []string{},
Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# GoNB Changelog

## v0.3.9

* Small Go Report Card fixes (https://goreportcard.com/report/github.com/janpfeifer/gonb)

## v0.3.8

* Fixed CSS for VSCode/Github Codespaces -- it doesn't play very well with Jupyter CSS.
Expand Down
1 change: 0 additions & 1 deletion goexec/goexec.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ with:
!go install golang.org/x/tools/gopls@latest
` + "```\n"
log.Printf(msg)
err = nil
}

log.Printf("Initialized goexec.State in %s", s.TempDir)
Expand Down
22 changes: 6 additions & 16 deletions goexec/goplsclient/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import (
"context"
"encoding/json"
"fmt"
"log"
"net"
"strings"
"time"

jsonrpc2 "github.com/go-language-server/jsonrpc2"
lsp "github.com/go-language-server/protocol"
"github.com/go-language-server/uri"
"github.com/golang/glog"
"github.com/pkg/errors"
"log"
"net"
"strings"
"time"
)

var _ = lsp.MethodInitialize
Expand Down Expand Up @@ -175,7 +176,7 @@ func (c *Client) notifyDidOpenOrChangeLocked(ctx context.Context, filePath strin
Version: &version,
},
ContentChanges: []lsp.TextDocumentContentChangeEvent{
lsp.TextDocumentContentChangeEvent{
{
Text: fileData.Content,
},
},
Expand Down Expand Up @@ -341,17 +342,6 @@ func trimString(s string, maxLen int) string {
return s[:maxLen-1] + `…`
}

// sampleRawJson returns a sample of the raw Json message (up to 100 bytes)
// converted to string. For logging/debugging prints.
func sampleRawJson(content json.RawMessage) string {
b := []byte(content)
if len(b) > 100 {
return string(b[:100]) + "..."

}
return string(b)
}

// Deliver implements jsonrpc2.Handler.
func (h *jsonrpc2Handler) Deliver(ctx context.Context, r *jsonrpc2.Request, delivered bool) bool {
_ = ctx
Expand Down
4 changes: 2 additions & 2 deletions goexec/goplsclient/goplsclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (c *Client) Shutdown() {
}

// isGoInternalOrCache returns whether if file is from Go implementation or
// cached from a versioned library, in which case it's not expected to be changed
// cached from a versioned library, in which case it's not expected to be changed,
// and we don't need to open the file in gopls.
// TODO: implement, for now we always open all files.
func isGoInternalOrCache(filePath string) bool {
Expand Down Expand Up @@ -230,7 +230,7 @@ func (c *Client) FileData(filePath string) (content *FileData, updated bool, err
return
}
glog.V(2).Infof("File %q: stored date is %s, fileInfo mod time is %s",
content.ContentTime, fileInfo.ModTime())
filePath, content.ContentTime, fileInfo.ModTime())
}

content = &FileData{
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func SetUpLogging() {
if *flagExtraLog != "" {
f, err := os.OpenFile(*flagExtraLog, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644)
if err != nil {
log.Fatalf("Failed to open log file %q for writting: %+v", *flagExtraLog, err)
log.Fatalf("Failed to open log file %q for writing: %+v", *flagExtraLog, err)
}
f.Write([]byte("\n\n"))
w := io.MultiWriter(f, os.Stderr) // Write to STDERR and the newly open f.
Expand Down

0 comments on commit 0ffd268

Please sign in to comment.