gitea-client-wrapper

module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: Apache-2.0

README

ci

go mod version GoDoc goreportcard

GitHub license codecov GitHub latest SemVer tag) GitHub release)

for what

  • this project used to github golang lib project

Contributing

Contributor Covenant GitHub contributors

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."git@github.com:".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
  • more perfect test case coverage
  • more perfect benchmark case

env

  • minimum go version: go 1.19
  • change go 1.19, ^1.19, 1.19.12-bullseye, 1.19.12 to new go version

libs

lib version
https://github.com/stretchr/testify v1.8.4
https://github.com/sebdah/goldie v2.5.3

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

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL