diff --git a/fs_statfs_notype.go b/fs_statfs_notype.go index 134767d6..1b5bdbdf 100644 --- a/fs_statfs_notype.go +++ b/fs_statfs_notype.go @@ -17,7 +17,7 @@ package procfs // isRealProc returns true on architectures that don't have a Type argument -// in their Statfs_t struct -func isRealProc(mountPoint string) (bool, error) { +// in their Statfs_t struct. +func isRealProc(_ string) (bool, error) { return true, nil } diff --git a/go.mod b/go.mod index 7b11e1b7..e45aa573 100644 --- a/go.mod +++ b/go.mod @@ -6,5 +6,4 @@ require ( github.com/google/go-cmp v0.6.0 golang.org/x/sync v0.7.0 golang.org/x/sys v0.19.0 - k8s.io/utils v0.0.0-20240310230437-4693a0247e57 ) diff --git a/go.sum b/go.sum index acdad1cc..2e562205 100644 --- a/go.sum +++ b/go.sum @@ -4,5 +4,3 @@ golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -k8s.io/utils v0.0.0-20240310230437-4693a0247e57 h1:gbqbevonBh57eILzModw6mrkbwM0gQBEuevE/AaBsHY= -k8s.io/utils v0.0.0-20240310230437-4693a0247e57/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= diff --git a/net_ip_socket.go b/net_ip_socket.go index 8ebe3831..9f32ff4f 100644 --- a/net_ip_socket.go +++ b/net_ip_socket.go @@ -22,8 +22,6 @@ import ( "os" "strconv" "strings" - - "k8s.io/utils/ptr" ) var ( @@ -33,7 +31,7 @@ var ( // In theory, the number of available sockets is 65535 (2^16 - 1) per IP. // With e.g. 150 Byte per line and the maximum number of 65535, // the reader needs to handle 150 Byte * 65535 =~ 10 MB for a single IP. - defaultReadLimit = ptr.To(4294967296) // Byte -> 4 GiB + defaultReadLimit = ptrTo(4294967296) // Byte -> 4 GiB ) // This contains generic data structures for both udp and tcp sockets. diff --git a/utils.go b/utils.go new file mode 100644 index 00000000..c56c9415 --- /dev/null +++ b/utils.go @@ -0,0 +1,19 @@ +// Copyright 2024 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +// To returns a pointer to the given value. +func ptrTo[T any](v T) *T { + return &v +}