fix(lint): Finish to apply linter recommandation
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -254,6 +254,7 @@ func (g Golang) PostInstall(path string) error {
|
||||
if len(lineBashRc) > 1 {
|
||||
log.Debug("Adding env variable to .bashrc")
|
||||
|
||||
//nolint:gosec // we did compute the file path
|
||||
fh, err := os.OpenFile(
|
||||
filepath.Join(homeDir, ".bashrc"),
|
||||
os.O_APPEND|os.O_CREATE|os.O_WRONLY,
|
||||
|
@ -162,6 +162,7 @@ func (s Swagger) Install(path string) error {
|
||||
return errors.Trace(err)
|
||||
}
|
||||
|
||||
//nolint:gosec // we did compute the file path
|
||||
fh, err := os.OpenFile(
|
||||
filepath.Join(path, "swagger"),
|
||||
os.O_RDWR|os.O_CREATE|os.O_TRUNC,
|
||||
@ -228,6 +229,7 @@ func (s Swagger) PostInstall(path string) error {
|
||||
if len(lineBashRc) > 1 {
|
||||
log.Debug("Adding env variable to .bashrc")
|
||||
|
||||
//nolint:gosec // we did compute the file path
|
||||
fh, err := os.OpenFile(
|
||||
filepath.Join(homeDir, ".bashrc"),
|
||||
os.O_APPEND|os.O_CREATE|os.O_WRONLY,
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
// content will probably be untar, ungzip, ....
|
||||
func downloadFile(url string) (io.Reader, error) {
|
||||
// Get the data
|
||||
//nolint:gosec,noctx // we trust the url
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
return nil, errors.Trace(err)
|
||||
@ -93,7 +94,7 @@ func unTar(reader io.Reader, subdir string, dest string) error {
|
||||
log.Debugf("Extacting %s", target)
|
||||
|
||||
switch header.Typeflag {
|
||||
// create directory if doesn't exit
|
||||
// create directory if doesn't exit.
|
||||
case tar.TypeDir:
|
||||
if _, err := os.Stat(target); err != nil {
|
||||
if err := os.MkdirAll(target, 0750); err != nil {
|
||||
@ -102,6 +103,7 @@ func unTar(reader io.Reader, subdir string, dest string) error {
|
||||
}
|
||||
// create file
|
||||
case tar.TypeReg:
|
||||
//nolint:gosec // we did compute the file path.
|
||||
f, err := os.OpenFile(target, os.O_CREATE|os.O_RDWR, os.FileMode(header.Mode))
|
||||
if err != nil {
|
||||
return errors.Trace(err)
|
||||
@ -113,7 +115,8 @@ func unTar(reader io.Reader, subdir string, dest string) error {
|
||||
}
|
||||
}()
|
||||
|
||||
// copy contents to file
|
||||
// copy contents to file.
|
||||
//nolint:gosec // TODO: do a decompression that protect from decompression bomb.
|
||||
if _, err := io.Copy(f, tr); err != nil {
|
||||
return errors.Trace(err)
|
||||
}
|
||||
@ -166,6 +169,7 @@ func unZip(reader io.Reader, subdir string, dest string) error {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//nolint:gosec // we did compute the file path.
|
||||
f, err := os.OpenFile(target, os.O_CREATE|os.O_RDWR, file.Mode())
|
||||
if err != nil {
|
||||
return errors.Trace(err)
|
||||
@ -189,6 +193,7 @@ func unZip(reader io.Reader, subdir string, dest string) error {
|
||||
}()
|
||||
|
||||
// copy contents to file
|
||||
//nolint:gosec // TODO: do a decompression that protect from decompression bomb.
|
||||
if _, err := io.Copy(f, fileInArchive); err != nil {
|
||||
return errors.Trace(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user