Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Secure solution for nexus infrastructure
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flg_masters
TM
Secure solution for nexus infrastructure
Commits
75d90121
Commit
75d90121
authored
4 months ago
by
Florent Gluck
Browse files
Options
Downloads
Patches
Plain Diff
Replaced use of deprecated ioutil functions by modern equivalents
parent
5aa5c230
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/client/cmdMisc/ls.go
+2
-2
2 additions, 2 deletions
src/client/cmdMisc/ls.go
src/libclient/utils/strings.go
+2
-2
2 additions, 2 deletions
src/libclient/utils/strings.go
src/server/vms/vms.go
+1
-2
1 addition, 2 deletions
src/server/vms/vms.go
with
5 additions
and
6 deletions
src/client/cmdMisc/ls.go
+
2
−
2
View file @
75d90121
package
cmdMisc
package
cmdMisc
import
(
import
(
"io/ioutil"
u
"nexus-client/utils"
u
"nexus-client/utils"
"os"
)
)
type
Ls
struct
{
type
Ls
struct
{
...
@@ -42,7 +42,7 @@ func (cmd *Ls) Run(args []string) int {
...
@@ -42,7 +42,7 @@ func (cmd *Ls) Run(args []string) int {
// List files in the specified directory.
// List files in the specified directory.
func
(
cmd
*
Ls
)
listDir
(
dir
string
)
{
func
(
cmd
*
Ls
)
listDir
(
dir
string
)
{
fis
,
err
:=
ioutil
.
ReadDir
(
dir
)
fis
,
err
:=
os
.
ReadDir
(
dir
)
if
err
!=
nil
{
if
err
!=
nil
{
u
.
PrintlnErr
(
"Failed reading
\"
"
+
dir
+
"
\"
directory: "
+
err
.
Error
())
u
.
PrintlnErr
(
"Failed reading
\"
"
+
dir
+
"
\"
directory: "
+
err
.
Error
())
return
return
...
...
This diff is collapsed.
Click to expand it.
src/libclient/utils/strings.go
+
2
−
2
View file @
75d90121
...
@@ -2,8 +2,8 @@ package utils
...
@@ -2,8 +2,8 @@ package utils
import
(
import
(
"fmt"
"fmt"
"io/ioutil"
"net/mail"
"net/mail"
"os"
"strings"
"strings"
)
)
...
@@ -28,7 +28,7 @@ func Str2UsbDevices(s string) []string {
...
@@ -28,7 +28,7 @@ func Str2UsbDevices(s string) []string {
// Returns the content of file as a string
// Returns the content of file as a string
func
FileToString
(
file
string
)
(
string
,
error
)
{
func
FileToString
(
file
string
)
(
string
,
error
)
{
content
,
err
:=
ioutil
.
ReadFile
(
file
)
content
,
err
:=
os
.
ReadFile
(
file
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
...
...
This diff is collapsed.
Click to expand it.
src/server/vms/vms.go
+
1
−
2
View file @
75d90121
...
@@ -3,7 +3,6 @@ package vms
...
@@ -3,7 +3,6 @@ package vms
import
(
import
(
"encoding/base64"
"encoding/base64"
"errors"
"errors"
"io/ioutil"
"math"
"math"
"nexus-common/caps"
"nexus-common/caps"
"nexus-common/params"
"nexus-common/params"
...
@@ -331,7 +330,7 @@ func (vms *VMs) prepareStartVM(vmID uuid.UUID, attachPwd string) (*osexec.Cmd, *
...
@@ -331,7 +330,7 @@ func (vms *VMs) prepareStartVM(vmID uuid.UUID, attachPwd string) (*osexec.Cmd, *
pwdBase64
:=
base64
.
StdEncoding
.
EncodeToString
([]
byte
(
spicePwd
))
pwdBase64
:=
base64
.
StdEncoding
.
EncodeToString
([]
byte
(
spicePwd
))
content
:=
[]
byte
(
pwdBase64
)
content
:=
[]
byte
(
pwdBase64
)
spicePwdFile
:=
filepath
.
Join
(
vm
.
dir
,
vmSecretFile
)
spicePwdFile
:=
filepath
.
Join
(
vm
.
dir
,
vmSecretFile
)
if
err
:=
ioutil
.
WriteFile
(
spicePwdFile
,
content
,
0600
);
err
!=
nil
{
if
err
:=
os
.
WriteFile
(
spicePwdFile
,
content
,
0600
);
err
!=
nil
{
msg
:=
prefix
+
"error creating secret file: "
+
err
.
Error
()
msg
:=
prefix
+
"error creating secret file: "
+
err
.
Error
()
log
.
Error
(
msg
)
log
.
Error
(
msg
)
return
nil
,
nil
,
""
,
0
,
0
,
errors
.
New
(
msg
)
return
nil
,
nil
,
""
,
0
,
0
,
errors
.
New
(
msg
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment