🔀 Merge branch 'develop'
This commit is contained in:
commit
42da6d95f8
5 changed files with 22 additions and 13 deletions
|
@ -2,15 +2,12 @@ image: golang:alpine
|
|||
|
||||
stages:
|
||||
- test
|
||||
- review
|
||||
|
||||
before_script:
|
||||
- apk add --no-cache git build-base bash make
|
||||
- mkdir -p /go/src/gitlab.com/$CI_PROJECT_NAMESPACE /go/src/_/builds
|
||||
- cp -r $CI_PROJECT_DIR /go/src/gitlab.com/$CI_PROJECT_PATH
|
||||
- ln -s /go/src/gitlab.com/$CI_PROJECT_NAMESPACE /go/src/_/builds/$CI_PROJECT_NAMESPACE
|
||||
- go get github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||
- go install github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||
- make dep
|
||||
|
||||
unit_tests:
|
||||
|
@ -22,10 +19,4 @@ code_coverage:
|
|||
stage: test
|
||||
script:
|
||||
- make coverage
|
||||
coverage: '/^coverage:\s(\d+(?:\.\d+)?%)/'
|
||||
|
||||
lint_code:
|
||||
stage: review
|
||||
script:
|
||||
- make lint
|
||||
allow_failure: true
|
||||
coverage: '/^coverage:\s(\d+(?:\.\d+)?%)/'
|
|
@ -46,7 +46,7 @@ func TestFetchEmbed(t *testing.T) {
|
|||
t.Run(url, func(t *testing.T) {
|
||||
provider := findProvider(url)
|
||||
if provider == nil {
|
||||
provider = &Provider{Endpoints: []Endpoint{Endpoint{}}}
|
||||
provider = &Provider{Endpoints: []Endpoint{{}}}
|
||||
}
|
||||
|
||||
_, err := fetchEmbed(url, provider, nil)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Package oembed add utils for supporting oEmbed fetching data,
|
||||
package oembed
|
||||
|
||||
import "golang.org/x/xerrors"
|
||||
|
|
17
patrons.go
Normal file
17
patrons.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
package oembed
|
||||
|
||||
import (
|
||||
"log"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func init() {
|
||||
patrons := []string{"Aurielb", "MoD21k", "Yami Odymel"}
|
||||
sort.Strings(patrons)
|
||||
log.Print(
|
||||
"Support toby3d on Patreon: https://patreon.com/bePatron?c=243288", "\n",
|
||||
"The current version of oembed is sponsored by: ",
|
||||
strings.Join(patrons[:len(patrons)-1], ", "), " and ", patrons[len(patrons)-1],
|
||||
)
|
||||
}
|
4
types.go
4
types.go
|
@ -9,7 +9,7 @@ type (
|
|||
Endpoints []Endpoint `json:"endpoints"`
|
||||
}
|
||||
|
||||
// Provider represent a single endpoint of Provider
|
||||
// Endpoint represent a single endpoint of Provider
|
||||
Endpoint struct {
|
||||
Schemes []string `json:"schemes,omitempty"`
|
||||
URL string `json:"url"`
|
||||
|
@ -17,7 +17,7 @@ type (
|
|||
Formats []string `json:"formats,omitempty"`
|
||||
}
|
||||
|
||||
// Response can specify a resource type, such as photo or video.
|
||||
// OEmbed can specify a resource type, such as photo or video.
|
||||
// Each type has specific parameters associated with it.
|
||||
OEmbed struct {
|
||||
// The resource type.
|
||||
|
|
Loading…
Reference in a new issue