From 8b9aa6171864c7c6893d6d5722c0daf2037e8f8e Mon Sep 17 00:00:00 2001 From: 6543 <6543@noreply.gitea.io> Date: Tue, 15 Sep 2020 16:55:31 +0000 Subject: [PATCH] Check Gitea Version Requirement (#419) Readme: show Version Requirements SDK: dont support gitea < 1.10 Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/419 Reviewed-by: Andrew Thornton Reviewed-by: John Olheiser --- README.md | 4 ++++ gitea/client.go | 3 +++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 7809b76..4c6bc38 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ This project acts as a client SDK implementation written in Go to interact with import "code.gitea.io/sdk/gitea" ``` +## Version Requirements + * go >= 1.13 + * gitea >= 1.10 + ## Contributing Fork -> Patch -> Push -> Pull Request diff --git a/gitea/client.go b/gitea/client.go index 7f03b59..7516ff6 100644 --- a/gitea/client.go +++ b/gitea/client.go @@ -55,6 +55,9 @@ func NewClient(url string, options ...func(*Client)) (*Client, error) { for _, opt := range options { opt(client) } + if err := client.CheckServerVersionConstraint(">=1.10"); err != nil { + return nil, err + } return client, nil }