# README
for what
- this project used to github golang lib project
Contributing
We welcome community contributions to this project.
Please read Contributor Guide for more information on how to get started.
请阅读有关 贡献者指南 以获取更多如何入门的信息
depends
in go mod project
# warning use private git host must set
# global set for once
# add private git host like github.com to evn GOPRIVATE
$ go env -w GOPRIVATE='github.com'
# use ssh proxy
# set ssh-key to use ssh as http
$ git config --global url."[email protected]:".insteadOf "https://github.com/"
# or use PRIVATE-TOKEN
# set PRIVATE-TOKEN as gitlab or gitea
$ git config --global http.extraheader "PRIVATE-TOKEN: {PRIVATE-TOKEN}"
# set this rep to download ssh as https use PRIVATE-TOKEN
$ git config --global url."ssh://github.com/".insteadOf "https://github.com/"
# before above global settings
# test version info
$ git ls-remote -q https://github.com/sinlov-go/gitea-client-wrapper.git
# test depends see full version
$ go list -mod readonly -v -m -versions github.com/sinlov-go/gitea-client-wrapper
# or use last version add go.mod by script
$ echo "go mod edit -require=$(go list -mod=readonly -m -versions github.com/sinlov-go/gitea-client-wrapper | awk '{print $1 "@" $NF}')"
$ echo "go mod vendor"
Features
-
gitea_token_client.GiteaTokenClient
to let api client easy to use -
client helper for gitea api
(1.2.+)-
GiteaApiParsef()
can parse api url by base api -
GetBaseApi()
can get base api -
SetBaseApi()
can change base api -
EscapeValidatePathSegments
help function to validate and encode url path segments - var
JsonHeader
for base api header (1.3.+)
-
-
GetRemoteGiteaVersion()
to get gitea server version once (1.3.+) - more perfect test case coverage
- more perfect benchmark case
env
- minimum go version: go 1.20
- change
go 1.20
,^1.20
,1.20.14
to new go version
libs
lib | version |
---|---|
https://github.com/stretchr/testify | v1.8.4 |
https://github.com/sebdah/goldie | v2.5.3 |
- more libs see go.mod
usage
gitea_token_client.GiteaTokenClient
package foo
import (
"github.com/sinlov-go/gitea-client-wrapper/gitea_token_client"
)
type GiteaApiClient struct {
gitea_token_client.GiteaTokenClient
}
func NewGiteaApiClient(url, accessToken string, timeoutSecond uint, insecure bool) (*GiteaApiClient, error) {
rc := GiteaApiClient{}
err := rc.NewClientWithHttpTimeout(url, accessToken, timeoutSecond, insecure)
if err != nil {
return nil, err
}
return &rc, nil
}
dev
# It needs to be executed after the first use or update of dependencies.
$ make init dep
- test code
$ make test testBenchmark
add main.go file and run
# run at env dev use cmd/main.go
$ make dev
- ci to fast check
# check style at local
$ make style
# run ci at local
$ make ci
docker
# then test build as test/Dockerfile
$ make dockerTestRestartLatest
# clean test build
$ make dockerTestPruneLatest
# more info see
$ make helpDocker
# Packages
No description provided by the author
No description provided by the author
No description provided by the author