Skip to content

Commit 8443efe

Browse files
committed
Use TrimPrefix as the go lang docs recommends
1 parent 57bad50 commit 8443efe

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

webserver/webserver.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (w *HttpHandler) handleExecuteCommand(response http.ResponseWriter, request
7474
var commandToExecute string
7575
var commandLine string
7676

77-
commandFromUrl := strings.TrimLeft(request.URL.Path, "/")
77+
commandFromUrl := strings.TrimPrefix(request.URL.Path, "/")
7878

7979
for _, command := range w.config.Commands {
8080
if command.CommandName == commandFromUrl {
@@ -112,15 +112,15 @@ func (w *HttpHandler) handleExecuteCommandJson(response http.ResponseWriter, req
112112

113113
var commandLine string
114114

115-
commandFromUrl := strings.TrimLeft(request.URL.Path, "/json/")
116-
fmt.Println(commandFromUrl)
115+
commandFromUrl := strings.TrimPrefix(request.URL.Path, "/json/")
116+
//fmt.Println(commandFromUrl)
117117

118118
for _, command := range w.config.Commands {
119119
if command.CommandName == commandFromUrl {
120120
commandLine = command.CommandLine
121121
}
122122
}
123-
fmt.Println(commandLine)
123+
//fmt.Println(commandLine)
124124

125125
timeout := 300 * time.Second
126126
result, _ := utils.RunCommand(w.parentCtx, utils.CommandArgs{

0 commit comments

Comments
 (0)