if gitea version is not detected, just fall back to last supported one and print warning #538
Labels
No Label
kind/breaking
kind/bug
kind/build
kind/dependency
kind/deployment
kind/docs
kind
enhancement
kind
feature
kind/proposal
kind
question
kind
refactor
kind/security
kind/testing
kind/translation
priority/critical
priority/high
priority/low
priority/medium
reviewed/duplicate
reviewed/invalid
reviewed/wontfix
skip-changelog
status/blocked
status/has-backport
status/has-pull
status/needs-backport
status/needs-feedback
status/needs-reviews
status/wip
upstream/gitea
upstream/sdk
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gitea/tea#538
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "6543/tea:option_to_ignore_gitea-version"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
close #531
@ -211,0 +210,4 @@
if !errors.Is(err, gitea.ErrUnknownVersion{}) {
log.Fatal(err)
}
fmt.Println("WARNING: could not detect gitea version!\nINFO: set gitea version: to last supported one")
hmm we should print to stderr
@ -208,3 +209,3 @@
client, err := gitea.NewClient(l.URL, options...)
if err != nil {
log.Fatal(err)
if !errors.Is(err, gitea.ErrUnknownVersion{}) {
You'll want to use
errors.As
here.@ -208,3 +209,3 @@
client, err := gitea.NewClient(l.URL, options...)
if err != nil {
log.Fatal(err)
var versionError *gitea.ErrUnknownVersion
only if we wana have the actual error back ... done
only if we wana have the actual error back ... done
PS: could not replay on the code-comment, looks like a bug, is it known?
Since it's not a sentinel error, we actually do need
errors.As
https://go.dev/play/p/t0jJd1D6bzZ
The review reply button bug is known, and should be fixed by https://github.com/go-gitea/gitea/pull/23846 (the commit right after current gitea.com 😅)
uh missed that in the sdk review ... you need to implement a interface and it works:
https://pkg.go.dev/errors#Is
->
func (m MyError) Is(target error) bool { return target == fs.ErrExist }
https://go.dev/play/p/le6FbO90IGU
True, I had chosen not to at the time because it seemed more explicit, but I suppose most people just care about true/false, not necessarily if it matches a specific pattern.
I can make a follow up PR there.