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
62be2050
Unverified
Commit
62be2050
authored
Apr 21, 2024
by
Cheng
Committed by
GitHub
Apr 20, 2024
Browse files
chore: use errors.New to replace fmt.Errorf will much better (#3789)
parent
56f8aa69
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
api/types.go
api/types.go
+2
-1
llm/payload.go
llm/payload.go
+1
-1
server/images.go
server/images.go
+2
-2
No files found.
api/types.go
View file @
62be2050
...
...
@@ -2,6 +2,7 @@ package api
import
(
"encoding/json"
"errors"
"fmt"
"math"
"os"
...
...
@@ -307,7 +308,7 @@ func (m *Metrics) Summary() {
}
}
var
ErrInvalidOpts
=
fmt
.
Errorf
(
"invalid options"
)
var
ErrInvalidOpts
=
errors
.
New
(
"invalid options"
)
func
(
opts
*
Options
)
FromMap
(
m
map
[
string
]
interface
{})
error
{
valueOpts
:=
reflect
.
ValueOf
(
opts
)
.
Elem
()
// names of the fields in the options struct
...
...
llm/payload.go
View file @
62be2050
...
...
@@ -17,7 +17,7 @@ import (
"github.com/ollama/ollama/gpu"
)
var
errPayloadMissing
=
fmt
.
Errorf
(
"expected payloads not included in this build of ollama"
)
var
errPayloadMissing
=
errors
.
New
(
"expected payloads not included in this build of ollama"
)
func
Init
()
error
{
payloadsDir
,
err
:=
gpu
.
PayloadsDir
()
...
...
server/images.go
View file @
62be2050
...
...
@@ -1137,7 +1137,7 @@ func GetSHA256Digest(r io.Reader) (string, int64) {
return
fmt
.
Sprintf
(
"sha256:%x"
,
h
.
Sum
(
nil
)),
n
}
var
errUnauthorized
=
fmt
.
Errorf
(
"unauthorized"
)
var
errUnauthorized
=
errors
.
New
(
"unauthorized"
)
func
makeRequestWithRetry
(
ctx
context
.
Context
,
method
string
,
requestURL
*
url
.
URL
,
headers
http
.
Header
,
body
io
.
ReadSeeker
,
regOpts
*
registryOptions
)
(
*
http
.
Response
,
error
)
{
for
i
:=
0
;
i
<
2
;
i
++
{
...
...
@@ -1255,7 +1255,7 @@ func parseRegistryChallenge(authStr string) registryChallenge {
}
}
var
errDigestMismatch
=
fmt
.
Errorf
(
"digest mismatch, file must be downloaded again"
)
var
errDigestMismatch
=
errors
.
New
(
"digest mismatch, file must be downloaded again"
)
func
verifyBlob
(
digest
string
)
error
{
fp
,
err
:=
GetBlobsPath
(
digest
)
...
...
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