Add CI scripts

This commit is contained in:
Matthew Holt 2018-12-10 00:46:23 -07:00
parent 1f94da1ed1
commit 69cab9d3a1
No known key found for this signature in database
GPG Key ID: 2A349DD577D586A5
4 changed files with 90 additions and 1 deletions

23
.travis.yml Normal file
View File

@ -0,0 +1,23 @@
language: go
go:
- 1.x
- tip
matrix:
allow_failures:
- go: tip
fast_finish: true
install:
- go get -t ./...
- go get golang.org/x/lint/golint
- go get github.com/alecthomas/gometalinter
script:
- gometalinter --install
- gometalinter --disable-all -E vet -E gofmt-s -E misspell -E ineffassign -E goimports -E deadcode --tests ./...
- go test -race ./...
after_script:
- golint ./...

View File

@ -297,7 +297,7 @@ For example, if you're using the standard library:
```go
mux := http.NewServeMux()
mux.Handle("/", func(w http.ResponseWriter, req *http.Request) {
mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "Lookit my cool website over HTTPS!")
})

31
appveyor.yml Normal file
View File

@ -0,0 +1,31 @@
version: "{build}"
clone_folder: c:\gopath\src\github.com\mholt\certmagic
environment:
GOPATH: c:\gopath
stack: go 1.11
install:
- set PATH=%GOPATH%\bin;%PATH%
- set PATH=C:\msys64\mingw64\bin;%PATH%
- go get -t ./...
- go get golang.org/x/lint/golint
- go get github.com/alecthomas/gometalinter
build: off
before_test:
- go version
- go env
test_script:
- gometalinter --install
- gometalinter --disable-all -E vet -E gofmt-s -E misspell -E ineffassign -E goimports -E deadcode --tests ./...
- go test -race ./...
after_test:
- golint ./...
deploy: off

35
doc_test.go Normal file
View File

@ -0,0 +1,35 @@
// Copyright 2015 Matthew Holt
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package certmagic
import (
"fmt"
"log"
"net/http"
)
// This is the simplest way for HTTP servers to use this package.
// Call HTTPS() with your domain names and your handler (or nil
// for the http.DefaultMux), and CertMagic will do the rest.
func ExampleHTTPS() {
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "Hello, HTTPS visitor!")
})
err := HTTPS([]string{"example.com", "www.example.com"}, nil)
if err != nil {
log.Fatal(err)
}
}