Skip to content

Commit 29253f4

Browse files
apocelipesgopherbot
authored andcommitted
os/exec: Use the built-in function min instead of minInt
The built-in function `min` has been implemented and can now be used to replace some manually written `minType` helper functions. Change-Id: Ie8ffc7881c8652ece752751214f1242bf76a6e7e GitHub-Last-Rev: 5db344f GitHub-Pull-Request: #60866 Reviewed-on: https://go-review.googlesource.com/c/go/+/504315 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: David Chase <[email protected]> Reviewed-by: qiulaidongfeng <[email protected]>
1 parent 840ec05 commit 29253f4

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/os/exec/exec.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ func (w *prefixSuffixSaver) Write(p []byte) (n int, err error) {
10961096
// grow larger than w.N. It returns the un-appended suffix of p.
10971097
func (w *prefixSuffixSaver) fill(dst *[]byte, p []byte) (pRemain []byte) {
10981098
if remain := w.N - len(*dst); remain > 0 {
1099-
add := minInt(len(p), remain)
1099+
add := min(len(p), remain)
11001100
*dst = append(*dst, p[:add]...)
11011101
p = p[add:]
11021102
}
@@ -1121,13 +1121,6 @@ func (w *prefixSuffixSaver) Bytes() []byte {
11211121
return buf.Bytes()
11221122
}
11231123

1124-
func minInt(a, b int) int {
1125-
if a < b {
1126-
return a
1127-
}
1128-
return b
1129-
}
1130-
11311124
// environ returns a best-effort copy of the environment in which the command
11321125
// would be run as it is currently configured. If an error occurs in computing
11331126
// the environment, it is returned alongside the best-effort copy.

0 commit comments

Comments
 (0)