Skip to content

Commit

Permalink
Fix cli npm package installs on Linux/MacOS (#2589)
Browse files Browse the repository at this point in the history
* Fix golint warnings

Signed-off-by: Chad Wilson <chadw@thoughtworks.com>

* Fix cli npm package installs on Linux/MacOS

Locks package at 0.5.14 since 0.5.15 seemed to introduce
the problem at cthackers/adm-zip#530

Signed-off-by: Chad Wilson <chadw@thoughtworks.com>

---------

Signed-off-by: Chad Wilson <chadw@thoughtworks.com>
  • Loading branch information
chadlwilson committed Aug 14, 2024
1 parent 874ca2e commit afc97cb
Show file tree
Hide file tree
Showing 30 changed files with 714 additions and 328 deletions.
10 changes: 5 additions & 5 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ func RunInBackground(apiPort string, specDirs []string) {
if apiPort != "" {
port, err = strconv.Atoi(apiPort)
if err != nil {
logger.Fatalf(true, fmt.Sprintf("Invalid port number: %s", apiPort))
logger.Fatalf(true, "Invalid port number: %s", apiPort)
}
os.Setenv(common.APIPortEnvVariableName, apiPort)
} else {
port, err = conn.GetPortFromEnvironmentVariable(common.APIPortEnvVariableName)
if err != nil {
logger.Fatalf(true, fmt.Sprintf("Failed to start API Service. %s \n", err.Error()))
logger.Fatalf(true, "Failed to start API Service. %s \n", err.Error())
}
}
runAPIServiceIndefinitely(port, specDirs)
Expand All @@ -140,18 +140,18 @@ func Start(specsDir []string) *conn.GaugeConnectionHandler {
apiHandler := &gaugeAPIMessageHandler{specInfoGatherer: sig}
gaugeConnectionHandler, err := conn.NewGaugeConnectionHandler(0, apiHandler)
if err != nil {
logger.Fatalf(true, err.Error())
logger.Fatal(true, err.Error())
}
errChan := make(chan error)
go func() {
_, err := gaugeConnectionHandler.AcceptConnection(config.RunnerConnectionTimeout(), errChan)
if err != nil {
logger.Fatalf(true, err.Error())
logger.Fatal(true, err.Error())
}
}()
go func() {
e := <-errChan
logger.Fatalf(true, e.Error())
logger.Fatal(true, e.Error())
}()
return gaugeConnectionHandler
}
10 changes: 5 additions & 5 deletions api/lang/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type lspWriter struct {
}

func (w lspWriter) Write(p []byte) (n int, err error) {
logger.Debugf(false, string(p))
logger.Debug(false, string(p))
return os.Stderr.Write(p)
}

Expand Down Expand Up @@ -61,25 +61,25 @@ func initialize(ctx context.Context, conn *jsonrpc2.Conn) {

func logDebug(req *jsonrpc2.Request, msg string, args ...interface{}) {
m := fmt.Sprintf(getLogFormatFor(req, msg), args...)
logger.Debugf(false, m)
logger.Debug(false, m)
logToLsp(lsp.Log, m)
}

func logInfo(req *jsonrpc2.Request, msg string, args ...interface{}) {
m := fmt.Sprintf(getLogFormatFor(req, msg), args...)
logger.Infof(false, m)
logger.Info(false, m)
logToLsp(lsp.Info, m)
}

func logWarning(req *jsonrpc2.Request, msg string, args ...interface{}) {
m := fmt.Sprintf(getLogFormatFor(req, msg), args...)
logger.Warningf(false, m)
logger.Warning(false, m)
logToLsp(lsp.MTWarning, m)
}

func logError(req *jsonrpc2.Request, msg string, args ...interface{}) {
m := fmt.Sprintf(getLogFormatFor(req, msg), args...)
logger.Errorf(false, m)
logger.Error(false, m)
logToLsp(lsp.MTError, m)
}

Expand Down
Loading

0 comments on commit afc97cb

Please sign in to comment.