append
possibly assigns to a wrong variable CRT-D0001110 gdnServerFlags = append(gdnServerFlags, "--allow-host-access")
111 }
112
113 gdnArgs := append(gdnConfigFlag, append([]string{"server"}, gdnServerFlags...)...)114
115 var configFlags GdnBinaryFlags
116 if cmd.Guardian.Config != "" {
119 }
120
121 execCmd := exec.Command(cmd.Path, append(cmd.Args, args...)...)
122 execCmd.Env = append(env, cmd.Env...)123 execCmd.Stdin = cmd.Stdin
124 execCmd.Stdout = cmd.Stdout
125 execCmd.Stderr = cmd.Stderr
365 return nil, err
366 }
367
368 ioVolumeMounts := append(inputVolumeMounts, outputVolumeMounts...)369 ioVolumeMounts = append(ioVolumeMounts, cacheVolumeMounts...)
370
371 // if the working dir is already mounted, we can just re-use that volume.
244}
245
246func (worker *Worker) containerEnv(containerSpec runtime.ContainerSpec, fetchedImage FetchedImage) []string {
247 env := append(fetchedImage.Metadata.Env, containerSpec.Env...)248
249 if worker.dbWorker.HTTPProxyURL() != "" {
250 env = append(env, fmt.Sprintf("http_proxy=%s", worker.dbWorker.HTTPProxyURL()))
41}
42
43func (writer *dbEventWriter) writeDangling(data []byte) []byte {
44 text := append(writer.dangling, data...) 45
46 checkEncoding, _ := utf8.DecodeLastRune(text)
47 if checkEncoding == utf8.RuneError {
The builtin function append
returns the updated slice after the append operation.
This resulting slice is usually assigned back to the same variable that contained
the original slice to which new values were appended.
x = []int{1, 3, 5}
append(x, 7) // returns the value []int{1, 3, 5, 7}. This is usually assigned back to x
x := []int{}
y := []int{}
x = append(y, 1) // possibly wrong
x = []int{1, 3, 5}
x = append(x, 7)
x := []int{}
y := []int{}
y = append(y, 1) // append 1 to y