From f940a79ea9838bd792a9d0b0977d11febbdb3a7f Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Mon, 21 Mar 2022 23:22:24 +0100 Subject: [PATCH] Moved util/proc.go to util/proc/proc.go, added boilerplate --- cmd/executor/cmd/root.go | 3 ++- pkg/util/{ => proc}/proc.go | 21 ++++++++++++++++++--- pkg/util/{ => proc}/proc_test.go | 18 +++++++++++++++++- 3 files changed, 37 insertions(+), 5 deletions(-) rename pkg/util/{ => proc}/proc.go (88%) rename pkg/util/{ => proc}/proc_test.go (91%) diff --git a/cmd/executor/cmd/root.go b/cmd/executor/cmd/root.go index 8a8618f9bf..298340faff 100644 --- a/cmd/executor/cmd/root.go +++ b/cmd/executor/cmd/root.go @@ -32,6 +32,7 @@ import ( "github.com/GoogleContainerTools/kaniko/pkg/logging" "github.com/GoogleContainerTools/kaniko/pkg/timing" "github.com/GoogleContainerTools/kaniko/pkg/util" + "github.com/GoogleContainerTools/kaniko/pkg/util/proc" "github.com/containerd/containerd/platforms" v1 "github.com/google/go-containerregistry/pkg/v1" "github.com/pkg/errors" @@ -233,7 +234,7 @@ func addHiddenFlags(cmd *cobra.Command) { } func checkContained() bool { - return util.GetContainerRuntime(0, 0) != util.RuntimeNotFound + return proc.GetContainerRuntime(0, 0) != proc.RuntimeNotFound } // cacheFlagsValid makes sure the flags passed in related to caching are valid diff --git a/pkg/util/proc.go b/pkg/util/proc/proc.go similarity index 88% rename from pkg/util/proc.go rename to pkg/util/proc/proc.go index 5ba048a5f8..e4b5881dd8 100644 --- a/pkg/util/proc.go +++ b/pkg/util/proc/proc.go @@ -1,7 +1,22 @@ -// Package util proc provides tools for inspecting proc. -package util +/* +Copyright 2022 Google LLC -// Part of https://github.com/genuinetools/bpfd/blob/a4bfa5e3e9d1bfdbc56268a36a0714911ae9b6bf/proc/proc.go +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. +*/ + +// Ported from https://github.com/genuinetools/bpfd/blob/a4bfa5e3e9d1bfdbc56268a36a0714911ae9b6bf/proc/proc.go + +package proc import ( "fmt" diff --git a/pkg/util/proc_test.go b/pkg/util/proc/proc_test.go similarity index 91% rename from pkg/util/proc_test.go rename to pkg/util/proc/proc_test.go index 409eb76a01..a321034adf 100644 --- a/pkg/util/proc_test.go +++ b/pkg/util/proc/proc_test.go @@ -1,4 +1,20 @@ -package util +/* +Copyright 2022 Google LLC + +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 proc import ( "testing"