parent
517f442fa3
commit
1b12c25e43
8 changed files with 49 additions and 21 deletions
25
.gometalinter.json
Normal file
25
.gometalinter.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"Vendor": true,
|
||||
"Test": true,
|
||||
"Sort": [
|
||||
"path",
|
||||
"line",
|
||||
"column",
|
||||
"linter",
|
||||
"severity"
|
||||
],
|
||||
"Cyclo": 12,
|
||||
"Enable": [
|
||||
"gotypex",
|
||||
"varcheck",
|
||||
"gotype",
|
||||
"interfacer",
|
||||
"misspell",
|
||||
"ineffassign",
|
||||
"golint",
|
||||
"vet",
|
||||
"gosimple"
|
||||
],
|
||||
"Exclude": [],
|
||||
"Deadline": "2m"
|
||||
}
|
|
@ -12,6 +12,9 @@ env:
|
|||
|
||||
before_install:
|
||||
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && openssl aes-256-cbc -K $encrypted_26c593b079d9_key -iv $encrypted_26c593b079d9_iv -in .gitcookies.enc -out .gitcookies -d || true'
|
||||
# Install linters and misspell
|
||||
- go get -u github.com/alecthomas/gometalinter
|
||||
- gometalinter --install
|
||||
|
||||
install:
|
||||
- go get -t ./...
|
||||
|
|
18
Makefile
18
Makefile
|
@ -1,15 +1,21 @@
|
|||
.PHONY: all
|
||||
|
||||
default: clean checks test build
|
||||
GOFILES := $(shell go list -f '{{range $$index, $$element := .GoFiles}}{{$$.Dir}}/{{$$element}}{{"\n"}}{{end}}' ./... | grep -v '/vendor/')
|
||||
|
||||
test: clean
|
||||
go test -v -cover ./...
|
||||
default: clean checks test build
|
||||
|
||||
clean:
|
||||
rm -rf dist/ builds/ cover.out
|
||||
|
||||
checks:
|
||||
go vet ./...
|
||||
|
||||
build: clean
|
||||
go build
|
||||
|
||||
test: clean
|
||||
go test -v -cover ./...
|
||||
|
||||
checks: check-fmt
|
||||
gometalinter ./...
|
||||
|
||||
check-fmt: SHELL := /bin/bash
|
||||
check-fmt:
|
||||
diff -u <(echo -n) <(gofmt -d $(GOFILES))
|
||||
|
|
|
@ -171,7 +171,7 @@ func (c *Client) Register(tosAgreed bool) (*RegistrationResource, error) {
|
|||
return reg, nil
|
||||
}
|
||||
|
||||
// Register the current account to the ACME server.
|
||||
// RegisterWithExternalAccountBinding Register the current account to the ACME server.
|
||||
func (c *Client) RegisterWithExternalAccountBinding(tosAgreed bool, kid string, hmacEncoded string) (*RegistrationResource, error) {
|
||||
if c == nil || c.user == nil {
|
||||
return nil, errors.New("acme: cannot register a nil client or user")
|
||||
|
|
|
@ -322,7 +322,8 @@ func run(c *cli.Context) error {
|
|||
cert, err = client.ObtainCertificate(c.GlobalStringSlice("domains"), !c.Bool("no-bundle"), nil, c.Bool("must-staple"))
|
||||
} else {
|
||||
// read the CSR
|
||||
csr, err := readCSRFile(c.GlobalString("csr"))
|
||||
var csr *x509.CertificateRequest
|
||||
csr, err = readCSRFile(c.GlobalString("csr"))
|
||||
if err == nil {
|
||||
// obtain a certificate for this CSR
|
||||
cert, err = client.ObtainCertificateForCSR(*csr, !c.Bool("no-bundle"))
|
||||
|
@ -330,12 +331,10 @@ func run(c *cli.Context) error {
|
|||
}
|
||||
|
||||
if err != nil {
|
||||
log.Printf("Could not obtain certificates\n\t%v", err)
|
||||
|
||||
// Make sure to return a non-zero exit code if ObtainSANCertificate
|
||||
// returned at least one error. Due to us not returning partial
|
||||
// certificate we can just exit here instead of at the end.
|
||||
os.Exit(1)
|
||||
log.Fatalf("Could not obtain certificates\n\t%v", err)
|
||||
}
|
||||
|
||||
if err = checkFolder(conf.CertPath()); err != nil {
|
||||
|
@ -408,7 +407,7 @@ func renew(c *cli.Context) error {
|
|||
log.Printf("Could not get Certification expiration for domain %s", domain)
|
||||
}
|
||||
|
||||
if int(expTime.Sub(time.Now()).Hours()/24.0) > c.Int("days") {
|
||||
if int(time.Until(expTime).Hours()/24.0) > c.Int("days") {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -208,9 +208,9 @@ func (c *DNSProvider) makeRequest(method, uri string, body io.Reader) (json.RawM
|
|||
}
|
||||
strBody := "Unreadable body"
|
||||
if body, err := ioutil.ReadAll(resp.Body); err == nil {
|
||||
strBody= string(body)
|
||||
strBody = string(body)
|
||||
}
|
||||
return nil, fmt.Errorf("Cloudflare API error. The request %s sent a response with a body which is not in JSON format : %s\n", req.URL.String(), strBody)
|
||||
return nil, fmt.Errorf("Cloudflare API error: the request %s sent a response with a body which is not in JSON format: %s", req.URL.String(), strBody)
|
||||
}
|
||||
|
||||
return r.Result, nil
|
||||
|
|
|
@ -90,7 +90,7 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
|
|||
|
||||
rrsets := rrSets{
|
||||
RRSets: []rrSet{
|
||||
rrSet{
|
||||
{
|
||||
Name: name,
|
||||
ChangeType: "REPLACE",
|
||||
Type: "TXT",
|
||||
|
@ -139,11 +139,7 @@ func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
|||
}
|
||||
|
||||
_, err = c.makeRequest("PATCH", zone.URL, bytes.NewReader(body))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *DNSProvider) getHostedZone(fqdn string) (*hostedZone, error) {
|
||||
|
|
|
@ -86,7 +86,6 @@ func dnsMux() *http.ServeMux {
|
|||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
})
|
||||
|
||||
mux.HandleFunc("/123456/domains/112233/records", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
Loading…
Reference in a new issue