mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-12-12 13:34:42 +00:00
Switch to v1.0.0 of github.com/MakeNowJust/heredoc (avoid SHA)
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
11
vendor/github.com/MakeNowJust/heredoc/heredoc.go
generated
vendored
11
vendor/github.com/MakeNowJust/heredoc/heredoc.go
generated
vendored
@@ -1,24 +1,31 @@
|
||||
// Copyright (c) 2014-2017 TSUYUSATO Kitsune
|
||||
// Copyright (c) 2014-2019 TSUYUSATO Kitsune
|
||||
// This software is released under the MIT License.
|
||||
// http://opensource.org/licenses/mit-license.php
|
||||
|
||||
// Package heredoc provides creation of here-documents from raw strings.
|
||||
//
|
||||
// Golang supports raw-string syntax.
|
||||
//
|
||||
// doc := `
|
||||
// Foo
|
||||
// Bar
|
||||
// `
|
||||
//
|
||||
// But raw-string cannot recognize indentation. Thus such content is an indented string, equivalent to
|
||||
//
|
||||
// "\n\tFoo\n\tBar\n"
|
||||
//
|
||||
// I dont't want this!
|
||||
//
|
||||
// However this problem is solved by package heredoc.
|
||||
//
|
||||
// doc := heredoc.Doc(`
|
||||
// Foo
|
||||
// Bar
|
||||
// `)
|
||||
//
|
||||
// Is equivalent to
|
||||
//
|
||||
// "Foo\nBar\n"
|
||||
package heredoc
|
||||
|
||||
@@ -33,7 +40,7 @@ const maxInt = int(^uint(0) >> 1)
|
||||
// Doc returns un-indented string as here-document.
|
||||
func Doc(raw string) string {
|
||||
skipFirstLine := false
|
||||
if raw[0] == '\n' {
|
||||
if len(raw) > 0 && raw[0] == '\n' {
|
||||
raw = raw[1:]
|
||||
} else {
|
||||
skipFirstLine = true
|
||||
|
||||
Reference in New Issue
Block a user