1
0
mirror of https://github.com/golang/go synced 2024-11-24 08:30:15 -07:00

shortened comment as per review suggestion

This commit is contained in:
Shawn Elliott 2019-04-22 10:44:53 -04:00
parent 4b61931e66
commit 796d343019

View File

@ -374,15 +374,10 @@ Words:
// Substitute command if required. // Substitute command if required.
if len(words) > 0 && g.commands[words[0]] != nil { if len(words) > 0 && g.commands[words[0]] != nil {
// Replace 0th word by command substitution. // Replace 0th word by command substitution.
// If no other words besides the command are on the invocation //
// line, e.g., // Force a copy of the command definition to
// //go:generate MY-COMMAND // ensure words doesn't end up as a reference
// append wouldn't force a copy as no increase in capacity was // to the g.commands content.
// needed. Instead, it would instead return a reference to
// the actual g.commands value (the original word array). We
// don't want the original word list to be subjected to os.Expand
// below, since the words in the command could contain changing
// environment variables, etc., so force a copy.
tmpCmdWords := append([]string(nil), (g.commands[words[0]])...) tmpCmdWords := append([]string(nil), (g.commands[words[0]])...)
words = append(tmpCmdWords, words[1:]...) words = append(tmpCmdWords, words[1:]...)
} }