]> Cypherpunks repositories - gostls13.git/commit
internal/syscall/unix: consolidate kernelVersion implementations
authorKir Kolyshkin <kolyshkin@gmail.com>
Thu, 18 Aug 2022 20:43:47 +0000 (13:43 -0700)
committerGopher Robot <gobot@golang.org>
Sat, 3 Sep 2022 18:39:45 +0000 (18:39 +0000)
commita73506cff560c4d95ac604f4f76d58386ca29ed9
tree3a923b1fcbd3c3f24ccb495bb434c20b3b312024
parent2392b7061cfc71dcdaefeb027dcce0951f697658
internal/syscall/unix: consolidate kernelVersion implementations

Currently, there are 3 functions returning Linux kernel version numbers.

Two of them are identical:
 - in net, initially added by commit 0a9dd47dd817904e;
 - in internal/poll, initially added by commit 1c7650aa93bd53;

(both were later fixed by commit 66c02645062561a).

The third one is a more complex, regexp-based implementation in
runtime/pprof, which is only used for a test.

Instead of adding one more, let's consolidate existing ones.

Remove the complex implementation, and move the simple one into
internal/syscall/unix. Use it from all the three places mentioned above.

Change-Id: I4a34d9ca47257743c16def30e4dd634e36056091
Reviewed-on: https://go-review.googlesource.com/c/go/+/424896
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/internal/poll/copy_file_range_linux.go
src/internal/syscall/unix/kernel_version_linux.go [new file with mode: 0644]
src/internal/syscall/unix/kernel_version_other.go [new file with mode: 0644]
src/net/sock_linux.go
src/net/sock_linux_test.go
src/runtime/pprof/pprof_test.go
src/runtime/pprof/uname_linux_test.go [deleted file]
src/runtime/pprof/uname_other_test.go [deleted file]