Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
c5e447a3
Commit
c5e447a3
authored
Jul 28, 2023
by
Michael Yang
Browse files
remove io/ioutil import
ioutil is deprecated
parent
fc40a4f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
server/images.go
server/images.go
+3
-4
No files found.
server/images.go
View file @
c5e447a3
...
@@ -7,7 +7,6 @@ import (
...
@@ -7,7 +7,6 @@ import (
"errors"
"errors"
"fmt"
"fmt"
"io"
"io"
"io/ioutil"
"log"
"log"
"net/http"
"net/http"
"os"
"os"
...
@@ -528,13 +527,13 @@ func CopyModel(src, dest string) error {
...
@@ -528,13 +527,13 @@ func CopyModel(src, dest string) error {
}
}
// copy the file
// copy the file
input
,
err
:=
ioutil
.
ReadFile
(
srcPath
)
input
,
err
:=
os
.
ReadFile
(
srcPath
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
"Error reading file:"
,
err
)
fmt
.
Println
(
"Error reading file:"
,
err
)
return
err
return
err
}
}
err
=
ioutil
.
WriteFile
(
destPath
,
input
,
0
o644
)
err
=
os
.
WriteFile
(
destPath
,
input
,
0
o644
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
"Error reading file:"
,
err
)
fmt
.
Println
(
"Error reading file:"
,
err
)
return
err
return
err
...
@@ -1009,7 +1008,7 @@ func downloadBlob(mp ModelPath, digest string, regOpts *RegistryOptions, fn func
...
@@ -1009,7 +1008,7 @@ func downloadBlob(mp ModelPath, digest string, regOpts *RegistryOptions, fn func
defer
resp
.
Body
.
Close
()
defer
resp
.
Body
.
Close
()
if
resp
.
StatusCode
!=
http
.
StatusOK
&&
resp
.
StatusCode
!=
http
.
StatusPartialContent
{
if
resp
.
StatusCode
!=
http
.
StatusOK
&&
resp
.
StatusCode
!=
http
.
StatusPartialContent
{
body
,
_
:=
io
util
.
ReadAll
(
resp
.
Body
)
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
return
fmt
.
Errorf
(
"on download registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
return
fmt
.
Errorf
(
"on download registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment