replace dep with go modules (#16017)

- guide shamelessly stolen from prometheus/prometheus
- updates local interface of oauth exchange
- updates local impl of hclogger
- bump jaeger client version

closes #16088
This commit is contained in:
Carl Bergquist
2019-04-16 12:00:55 +02:00
committed by GitHub
parent d6b48ee099
commit 68f5ddf18c
944 changed files with 181567 additions and 137219 deletions
+2
View File
@@ -0,0 +1,2 @@
_*
cover*.out
+58
View File
@@ -0,0 +1,58 @@
slug
====
Package `slug` generate slug from unicode string, URL-friendly slugify with
multiple languages support.
[![GoDoc](https://godoc.org/github.com/gosimple/slug?status.png)](https://godoc.org/github.com/gosimple/slug)
[![Build Status](https://travis-ci.com/gosimple/slug.svg?branch=master)](https://travis-ci.com/gosimple/slug)
[Documentation online](http://godoc.org/github.com/gosimple/slug)
## Example
```go
package main
import (
"fmt"
"github.com/gosimple/slug"
)
func main() {
text := slug.Make("Hellö Wörld хелло ворлд")
fmt.Println(text) // Will print: "hello-world-khello-vorld"
someText := slug.Make("影師")
fmt.Println(someText) // Will print: "ying-shi"
enText := slug.MakeLang("This & that", "en")
fmt.Println(enText) // Will print: "this-and-that"
deText := slug.MakeLang("Diese & Dass", "de")
fmt.Println(deText) // Will print: "diese-und-dass"
slug.CustomSub = map[string]string{
"water": "sand",
}
textSub := slug.Make("water is hot")
fmt.Println(textSub) // Will print: "sand-is-hot"
}
```
### Requests or bugs?
<https://github.com/gosimple/slug/issues>
## Installation
```sh
go get -u github.com/gosimple/slug
```
## License
The source files are distributed under the
[Mozilla Public License, version 2.0](http://mozilla.org/MPL/2.0/),
unless otherwise noted.
Please read the [FAQ](http://www.mozilla.org/MPL/2.0/FAQ.html)
if you have further questions regarding the license.
+29 -6
View File
@@ -7,7 +7,9 @@ package slug
func init() {
// Merge language subs with the default one
for _, sub := range []*map[rune]string{&deSub, &enSub, &plSub, &esSub} {
for _, sub := range []*map[rune]string{
&deSub, &enSub, &esSub, &fiSub, &grSub, &nlSub, &plSub,
} {
for key, value := range defaultSub {
(*sub)[key] = value
}
@@ -27,6 +29,12 @@ var defaultSub = map[rune]string{
var deSub = map[rune]string{
'&': "und",
'@': "an",
'ä': "ae",
'Ä': "ae",
'ö': "oe",
'Ö': "oe",
'ü': "ue",
'Ü': "ue",
}
var enSub = map[rune]string{
@@ -34,16 +42,16 @@ var enSub = map[rune]string{
'@': "at",
}
var plSub = map[rune]string{
'&': "i",
'@': "na",
}
var esSub = map[rune]string{
'&': "y",
'@': "en",
}
var fiSub = map[rune]string{
'&': "ja",
'@': "at",
}
var grSub = map[rune]string{
'&': "kai",
'η': "i",
@@ -51,7 +59,22 @@ var grSub = map[rune]string{
'Η': "i",
'ι': "i",
'ί': "i",
'ϊ': "i",
'Ι': "i",
'χ': "x",
'Χ': "x",
'ω': "w",
'ώ': "w",
'Ω': "w",
'ϋ': "u",
}
var nlSub = map[rune]string{
'&': "en",
'@': "at",
}
var plSub = map[rune]string{
'&': "i",
'@': "na",
}
+7 -3
View File
@@ -56,12 +56,16 @@ func MakeLang(s string, lang string) (slug string) {
slug = SubstituteRune(slug, deSub)
case "en":
slug = SubstituteRune(slug, enSub)
case "pl":
slug = SubstituteRune(slug, plSub)
case "es":
slug = SubstituteRune(slug, esSub)
case "fi":
slug = SubstituteRune(slug, fiSub)
case "gr":
slug = SubstituteRune(slug, grSub)
case "nl":
slug = SubstituteRune(slug, nlSub)
case "pl":
slug = SubstituteRune(slug, plSub)
default: // fallback to "en" if lang not found
slug = SubstituteRune(slug, enSub)
}
@@ -74,7 +78,7 @@ func MakeLang(s string, lang string) (slug string) {
// Process all remaining symbols
slug = regexpNonAuthorizedChars.ReplaceAllString(slug, "-")
slug = regexpMultipleDashes.ReplaceAllString(slug, "-")
slug = strings.Trim(slug, "-")
slug = strings.Trim(slug, "-_")
if MaxLength > 0 {
slug = smartTruncate(slug)