@@ -76,7 +76,7 @@ const (
7676)
7777
7878// ProgRequest is the JSON-encoded message that's sent from cmd/go to
79- // the GOCACHEPROG child process over stdin. Each JSON object is on its
79+ // the GOLANGCI_LINT_CACHEPROG child process over stdin. Each JSON object is on its
8080// own line. A ProgRequest of Type "put" with BodySize > 0 will be followed
8181// by a line containing a base64-encoded JSON string literal of the body.
8282type ProgRequest struct {
@@ -152,7 +152,7 @@ func startCacheProg(progAndArgs string, fuzzDirCache Cache) Cache {
152152 }
153153 args , err := quoted .Split (progAndArgs )
154154 if err != nil {
155- base .Fatalf ("GOCACHEPROG args: %v" , err )
155+ base .Fatalf ("%s args: %v" , envGolangciLintCacheProg , err )
156156 }
157157 var prog string
158158 if len (args ) > 0 {
@@ -165,17 +165,17 @@ func startCacheProg(progAndArgs string, fuzzDirCache Cache) Cache {
165165 cmd := exec .CommandContext (ctx , prog , args ... )
166166 out , err := cmd .StdoutPipe ()
167167 if err != nil {
168- base .Fatalf ("StdoutPipe to GOCACHEPROG : %v" , err )
168+ base .Fatalf ("StdoutPipe to %s : %v" , envGolangciLintCacheProg , err )
169169 }
170170 in , err := cmd .StdinPipe ()
171171 if err != nil {
172- base .Fatalf ("StdinPipe to GOCACHEPROG : %v" , err )
172+ base .Fatalf ("StdinPipe to %s : %v" , envGolangciLintCacheProg , err )
173173 }
174174 cmd .Stderr = os .Stderr
175175 cmd .Cancel = in .Close
176176
177177 if err := cmd .Start (); err != nil {
178- base .Fatalf ("error starting GOCACHEPROG program %q: %v" , prog , err )
178+ base .Fatalf ("error starting %s program %q: %v" , envGolangciLintCacheProg , prog , err )
179179 }
180180
181181 pc := & ProgCache {
@@ -206,14 +206,14 @@ func startCacheProg(progAndArgs string, fuzzDirCache Cache) Cache {
206206 for {
207207 select {
208208 case <- timer .C :
209- log .Printf ("# still waiting for GOCACHEPROG %v ..." , prog )
209+ log .Printf ("# still waiting for %s %v ..." , envGolangciLintCacheProg , prog )
210210 case capRes := <- capResc :
211211 can := map [ProgCmd ]bool {}
212212 for _ , cmd := range capRes .KnownCommands {
213213 can [cmd ] = true
214214 }
215215 if len (can ) == 0 {
216- base .Fatalf ("GOCACHEPROG %v declared no supported commands" , prog )
216+ base .Fatalf ("%s %v declared no supported commands" , envGolangciLintCacheProg , prog )
217217 }
218218 pc .can = can
219219 return pc
@@ -234,9 +234,9 @@ func (c *ProgCache) readLoop(readLoopDone chan<- struct{}) {
234234 c .mu .Lock ()
235235 inFlight := len (c .inFlight )
236236 c .mu .Unlock ()
237- base .Fatalf ("GOCACHEPROG exited pre-Close with %v pending requests" , inFlight )
237+ base .Fatalf ("%s exited pre-Close with %v pending requests" , envGolangciLintCacheProg , inFlight )
238238 }
239- base .Fatalf ("error reading JSON from GOCACHEPROG : %v" , err )
239+ base .Fatalf ("error reading JSON from %s : %v" , envGolangciLintCacheProg , err )
240240 }
241241 c .mu .Lock ()
242242 ch , ok := c .inFlight [res .ID ]
@@ -245,7 +245,7 @@ func (c *ProgCache) readLoop(readLoopDone chan<- struct{}) {
245245 if ok {
246246 ch <- res
247247 } else {
248- base .Fatalf ("GOCACHEPROG sent response for unknown request ID %v" , res .ID )
248+ base .Fatalf ("%s sent response for unknown request ID %v" , envGolangciLintCacheProg , res .ID )
249249 }
250250 }
251251}
@@ -303,8 +303,8 @@ func (c *ProgCache) writeToChild(req *ProgRequest, resc chan<- *ProgResponse) (e
303303 return nil
304304 }
305305 if wrote != req .BodySize {
306- return fmt .Errorf ("short write writing body to GOCACHEPROG for action %x, object %x: wrote %v; expected %v" ,
307- req .ActionID , req .ObjectID , wrote , req .BodySize )
306+ return fmt .Errorf ("short write writing body to %s for action %x, object %x: wrote %v; expected %v" ,
307+ envGolangciLintCacheProg , req .ActionID , req .ObjectID , wrote , req .BodySize )
308308 }
309309 if _ , err := c .bw .WriteString ("\" \n " ); err != nil {
310310 return err
@@ -346,7 +346,7 @@ func (c *ProgCache) Get(a ActionID) (Entry, error) {
346346 e .Time = time .Now ()
347347 }
348348 if res .DiskPath == "" {
349- return Entry {}, & entryNotFoundError {errors . New ( "GOCACHEPROG didn't populate DiskPath on get hit" )}
349+ return Entry {}, & entryNotFoundError {fmt . Errorf ( "%s didn't populate DiskPath on get hit", envGolangciLintCacheProg )}
350350 }
351351 if copy (e .OutputID [:], res .OutputID ) != len (res .OutputID ) {
352352 return Entry {}, & entryNotFoundError {errors .New ("incomplete ProgResponse OutputID" )}
@@ -400,7 +400,7 @@ func (c *ProgCache) Put(a ActionID, file io.ReadSeeker) (_ OutputID, size int64,
400400 return OutputID {}, 0 , err
401401 }
402402 if res .DiskPath == "" {
403- return OutputID {}, 0 , errors . New ( "GOCACHEPROG didn't return DiskPath in put response" )
403+ return OutputID {}, 0 , fmt . Errorf ( "%s didn't return DiskPath in put response", envGolangciLintCacheProg )
404404 }
405405 c .noteOutputFile (out , res .DiskPath )
406406 return out , size , err
0 commit comments