mirror of https://github.com/helm/helm
syscall.Umask does not exist on Windows, so 'go vet ./...' and
'go test ./internal/plugin/installer/' fail to compile there:
internal\plugin\installer\http_installer_test.go:212:26: undefined: syscall.Umask
Move the umask lookup behind build-tag-guarded helpers
(umask_unix_test.go / umask_windows_test.go) and skip the POSIX
permission assertions on Windows, where file modes are not honored.
TestExtract itself still runs on Windows to cover the extraction
path handling.
Verified with 'go vet' and 'go test' on windows/amd64, plus
GOOS=linux and GOOS=darwin 'go vet' cross-checks.
Signed-off-by: Mukul <nmukul32@gmail.com>
pull/32390/head
parent
8eb65528be
commit
83df34a39f
@ -0,0 +1,31 @@
|
||||
/*
|
||||
Copyright The Helm 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.
|
||||
*/
|
||||
|
||||
//go:build !windows
|
||||
|
||||
package installer
|
||||
|
||||
import "syscall"
|
||||
|
||||
// posixPermsSupported reports whether the platform honors POSIX file
|
||||
// permission bits, allowing tests to assert on extracted file modes.
|
||||
const posixPermsSupported = true
|
||||
|
||||
// processUmask returns the current process umask without changing it.
|
||||
func processUmask() int {
|
||||
umask := syscall.Umask(0)
|
||||
syscall.Umask(umask)
|
||||
return umask
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
/*
|
||||
Copyright The Helm 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.
|
||||
*/
|
||||
|
||||
//go:build windows
|
||||
|
||||
package installer
|
||||
|
||||
// posixPermsSupported reports whether the platform honors POSIX file
|
||||
// permission bits, allowing tests to assert on extracted file modes.
|
||||
// Windows does not, so permission assertions are skipped there.
|
||||
const posixPermsSupported = false
|
||||
|
||||
// processUmask returns 0 on Windows, which has no umask concept.
|
||||
func processUmask() int {
|
||||
return 0
|
||||
}
|
||||
Loading…
Reference in new issue