Merge pull request #110510 from dims/switch-to-github.com/MakeNowJust/heredoc-v1.0.0-and-avoid-SHA
Switch to v1.0.0 of github.com/MakeNowJust/heredoc (avoid SHA)
This commit is contained in:
2
vendor/github.com/MakeNowJust/heredoc/LICENSE
generated
vendored
2
vendor/github.com/MakeNowJust/heredoc/LICENSE
generated
vendored
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2017 TSUYUSATO Kitsune
|
||||
Copyright (c) 2014-2019 TSUYUSATO Kitsune
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
13
vendor/github.com/MakeNowJust/heredoc/README.md
generated
vendored
13
vendor/github.com/MakeNowJust/heredoc/README.md
generated
vendored
@@ -1,4 +1,6 @@
|
||||
# heredoc [](https://circleci.com/gh/MakeNowJust/heredoc) [](https://gowalker.org/github.com/MakeNowJust/heredoc)
|
||||
# heredoc
|
||||
|
||||
[](https://circleci.com/gh/MakeNowJust/heredoc) [](https://godoc.org/github.com/MakeNowJust/heredoc)
|
||||
|
||||
## About
|
||||
|
||||
@@ -15,8 +17,6 @@ $ go get github.com/MakeNowJust/heredoc
|
||||
```go
|
||||
// usual
|
||||
import "github.com/MakeNowJust/heredoc"
|
||||
// shortcuts
|
||||
import . "github.com/MakeNowJust/heredoc/dot"
|
||||
```
|
||||
|
||||
## Example
|
||||
@@ -26,11 +26,11 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
. "github.com/MakeNowJust/heredoc/dot"
|
||||
"github.com/MakeNowJust/heredoc"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println(D(`
|
||||
fmt.Println(heredoc.Doc(`
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit,
|
||||
sed do eiusmod tempor incididunt ut labore et dolore magna
|
||||
aliqua. Ut enim ad minim veniam, ...
|
||||
@@ -45,8 +45,7 @@ func main() {
|
||||
|
||||
## API Document
|
||||
|
||||
- [Go Walker - github.com/MakeNowJust/heredoc](https://gowalker.org/github.com/MakeNowJust/heredoc)
|
||||
- [Go Walker - github.com/MakeNowJust/heredoc/dot](https://gowalker.org/github.com/MakeNowJust/heredoc/dot)
|
||||
- [heredoc - GoDoc](https://godoc.org/github.com/MakeNowJust/heredoc)
|
||||
|
||||
## License
|
||||
|
||||
|
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