mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	update revive lint to latest commit (#12921)
* update revive lint to latest commit * make fmt * change import
This commit is contained in:
		
							
								
								
									
										24
									
								
								vendor/github.com/mattn/go-colorable/colorable_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								vendor/github.com/mattn/go-colorable/colorable_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -10,6 +10,7 @@ import (
 | 
			
		||||
	"os"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"sync"
 | 
			
		||||
	"syscall"
 | 
			
		||||
	"unsafe"
 | 
			
		||||
 | 
			
		||||
@@ -27,6 +28,7 @@ const (
 | 
			
		||||
	backgroundRed       = 0x40
 | 
			
		||||
	backgroundIntensity = 0x80
 | 
			
		||||
	backgroundMask      = (backgroundRed | backgroundBlue | backgroundGreen | backgroundIntensity)
 | 
			
		||||
	commonLvbUnderscore = 0x8000
 | 
			
		||||
 | 
			
		||||
	cENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x4
 | 
			
		||||
)
 | 
			
		||||
@@ -93,6 +95,7 @@ type Writer struct {
 | 
			
		||||
	oldattr   word
 | 
			
		||||
	oldpos    coord
 | 
			
		||||
	rest      bytes.Buffer
 | 
			
		||||
	mutex     sync.Mutex
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewColorable returns new instance of Writer which handles escape sequence from File.
 | 
			
		||||
@@ -432,6 +435,8 @@ func atoiWithDefault(s string, def int) (int, error) {
 | 
			
		||||
 | 
			
		||||
// Write writes data on console
 | 
			
		||||
func (w *Writer) Write(data []byte) (n int, err error) {
 | 
			
		||||
	w.mutex.Lock()
 | 
			
		||||
	defer w.mutex.Unlock()
 | 
			
		||||
	var csbi consoleScreenBufferInfo
 | 
			
		||||
	procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
 | 
			
		||||
 | 
			
		||||
@@ -683,14 +688,19 @@ loop:
 | 
			
		||||
					switch {
 | 
			
		||||
					case n == 0 || n == 100:
 | 
			
		||||
						attr = w.oldattr
 | 
			
		||||
					case 1 <= n && n <= 5:
 | 
			
		||||
					case n == 4:
 | 
			
		||||
						attr |= commonLvbUnderscore
 | 
			
		||||
					case (1 <= n && n <= 3) || n == 5:
 | 
			
		||||
						attr |= foregroundIntensity
 | 
			
		||||
					case n == 7:
 | 
			
		||||
						attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4)
 | 
			
		||||
					case n == 22 || n == 25:
 | 
			
		||||
						attr |= foregroundIntensity
 | 
			
		||||
					case n == 27:
 | 
			
		||||
						attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4)
 | 
			
		||||
					case n == 7 || n == 27:
 | 
			
		||||
						attr =
 | 
			
		||||
							(attr &^ (foregroundMask | backgroundMask)) |
 | 
			
		||||
								((attr & foregroundMask) << 4) |
 | 
			
		||||
								((attr & backgroundMask) >> 4)
 | 
			
		||||
					case n == 22:
 | 
			
		||||
						attr &^= foregroundIntensity
 | 
			
		||||
					case n == 24:
 | 
			
		||||
						attr &^= commonLvbUnderscore
 | 
			
		||||
					case 30 <= n && n <= 37:
 | 
			
		||||
						attr &= backgroundMask
 | 
			
		||||
						if (n-30)&1 != 0 {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/mattn/go-runewidth/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/mattn/go-runewidth/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,8 +1,16 @@
 | 
			
		||||
language: go
 | 
			
		||||
sudo: false
 | 
			
		||||
go:
 | 
			
		||||
  - 1.13.x
 | 
			
		||||
  - tip
 | 
			
		||||
 | 
			
		||||
before_install:
 | 
			
		||||
  - go get github.com/mattn/goveralls
 | 
			
		||||
  - go get golang.org/x/tools/cmd/cover
 | 
			
		||||
  - go get -t -v ./...
 | 
			
		||||
 | 
			
		||||
script:
 | 
			
		||||
    - $HOME/gopath/bin/goveralls -repotoken lAKAWPzcGsD3A8yBX3BGGtRUdJ6CaGERL
 | 
			
		||||
  - go generate
 | 
			
		||||
  - git diff --cached --exit-code
 | 
			
		||||
  - ./go.test.sh
 | 
			
		||||
 | 
			
		||||
after_success:
 | 
			
		||||
  - bash <(curl -s https://codecov.io/bash)
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ go-runewidth
 | 
			
		||||
============
 | 
			
		||||
 | 
			
		||||
[](https://travis-ci.org/mattn/go-runewidth)
 | 
			
		||||
[](https://coveralls.io/r/mattn/go-runewidth?branch=HEAD)
 | 
			
		||||
[](https://codecov.io/gh/mattn/go-runewidth)
 | 
			
		||||
[](http://godoc.org/github.com/mattn/go-runewidth)
 | 
			
		||||
[](https://goreportcard.com/report/github.com/mattn/go-runewidth)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										12
									
								
								vendor/github.com/mattn/go-runewidth/go.test.sh
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/mattn/go-runewidth/go.test.sh
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
set -e
 | 
			
		||||
echo "" > coverage.txt
 | 
			
		||||
 | 
			
		||||
for d in $(go list ./... | grep -v vendor); do
 | 
			
		||||
    go test -race -coverprofile=profile.out -covermode=atomic "$d"
 | 
			
		||||
    if [ -f profile.out ]; then
 | 
			
		||||
        cat profile.out >> coverage.txt
 | 
			
		||||
        rm profile.out
 | 
			
		||||
    fi
 | 
			
		||||
done
 | 
			
		||||
							
								
								
									
										1
									
								
								vendor/github.com/mattn/go-runewidth/runewidth.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/mattn/go-runewidth/runewidth.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -50,7 +50,6 @@ func inTables(r rune, ts ...table) bool {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func inTable(r rune, t table) bool {
 | 
			
		||||
	// func (t table) IncludesRune(r rune) bool {
 | 
			
		||||
	if r < t[0].first {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								vendor/github.com/mattn/go-runewidth/runewidth_posix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								vendor/github.com/mattn/go-runewidth/runewidth_posix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -62,7 +62,10 @@ func isEastAsian(locale string) bool {
 | 
			
		||||
 | 
			
		||||
// IsEastAsian return true if the current locale is CJK
 | 
			
		||||
func IsEastAsian() bool {
 | 
			
		||||
	locale := os.Getenv("LC_CTYPE")
 | 
			
		||||
	locale := os.Getenv("LC_ALL")
 | 
			
		||||
	if locale == "" {
 | 
			
		||||
		locale = os.Getenv("LC_CTYPE")
 | 
			
		||||
	}
 | 
			
		||||
	if locale == "" {
 | 
			
		||||
		locale = os.Getenv("LANG")
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										420
									
								
								vendor/github.com/mattn/go-runewidth/runewidth_table.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										420
									
								
								vendor/github.com/mattn/go-runewidth/runewidth_table.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,20 +1,23 @@
 | 
			
		||||
// Code generated by script/generate.go. DO NOT EDIT.
 | 
			
		||||
 | 
			
		||||
package runewidth
 | 
			
		||||
 | 
			
		||||
var combining = table{
 | 
			
		||||
	{0x0300, 0x036F}, {0x0483, 0x0489}, {0x07EB, 0x07F3},
 | 
			
		||||
	{0x0C00, 0x0C00}, {0x0C04, 0x0C04}, {0x0D00, 0x0D01},
 | 
			
		||||
	{0x135D, 0x135F}, {0x1A7F, 0x1A7F}, {0x1AB0, 0x1ABE},
 | 
			
		||||
	{0x135D, 0x135F}, {0x1A7F, 0x1A7F}, {0x1AB0, 0x1AC0},
 | 
			
		||||
	{0x1B6B, 0x1B73}, {0x1DC0, 0x1DF9}, {0x1DFB, 0x1DFF},
 | 
			
		||||
	{0x20D0, 0x20F0}, {0x2CEF, 0x2CF1}, {0x2DE0, 0x2DFF},
 | 
			
		||||
	{0x3099, 0x309A}, {0xA66F, 0xA672}, {0xA674, 0xA67D},
 | 
			
		||||
	{0xA69E, 0xA69F}, {0xA6F0, 0xA6F1}, {0xA8E0, 0xA8F1},
 | 
			
		||||
	{0xFE20, 0xFE2F}, {0x101FD, 0x101FD}, {0x10376, 0x1037A},
 | 
			
		||||
	{0x10F46, 0x10F50}, {0x11300, 0x11301}, {0x1133B, 0x1133C},
 | 
			
		||||
	{0x11366, 0x1136C}, {0x11370, 0x11374}, {0x16AF0, 0x16AF4},
 | 
			
		||||
	{0x1D165, 0x1D169}, {0x1D16D, 0x1D172}, {0x1D17B, 0x1D182},
 | 
			
		||||
	{0x1D185, 0x1D18B}, {0x1D1AA, 0x1D1AD}, {0x1D242, 0x1D244},
 | 
			
		||||
	{0x1E000, 0x1E006}, {0x1E008, 0x1E018}, {0x1E01B, 0x1E021},
 | 
			
		||||
	{0x1E023, 0x1E024}, {0x1E026, 0x1E02A}, {0x1E8D0, 0x1E8D6},
 | 
			
		||||
	{0x10EAB, 0x10EAC}, {0x10F46, 0x10F50}, {0x11300, 0x11301},
 | 
			
		||||
	{0x1133B, 0x1133C}, {0x11366, 0x1136C}, {0x11370, 0x11374},
 | 
			
		||||
	{0x16AF0, 0x16AF4}, {0x1D165, 0x1D169}, {0x1D16D, 0x1D172},
 | 
			
		||||
	{0x1D17B, 0x1D182}, {0x1D185, 0x1D18B}, {0x1D1AA, 0x1D1AD},
 | 
			
		||||
	{0x1D242, 0x1D244}, {0x1E000, 0x1E006}, {0x1E008, 0x1E018},
 | 
			
		||||
	{0x1E01B, 0x1E021}, {0x1E023, 0x1E024}, {0x1E026, 0x1E02A},
 | 
			
		||||
	{0x1E8D0, 0x1E8D6},
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var doublewidth = table{
 | 
			
		||||
@@ -32,29 +35,30 @@ var doublewidth = table{
 | 
			
		||||
	{0x2B50, 0x2B50}, {0x2B55, 0x2B55}, {0x2E80, 0x2E99},
 | 
			
		||||
	{0x2E9B, 0x2EF3}, {0x2F00, 0x2FD5}, {0x2FF0, 0x2FFB},
 | 
			
		||||
	{0x3000, 0x303E}, {0x3041, 0x3096}, {0x3099, 0x30FF},
 | 
			
		||||
	{0x3105, 0x312F}, {0x3131, 0x318E}, {0x3190, 0x31BA},
 | 
			
		||||
	{0x31C0, 0x31E3}, {0x31F0, 0x321E}, {0x3220, 0x3247},
 | 
			
		||||
	{0x3250, 0x4DBF}, {0x4E00, 0xA48C}, {0xA490, 0xA4C6},
 | 
			
		||||
	{0xA960, 0xA97C}, {0xAC00, 0xD7A3}, {0xF900, 0xFAFF},
 | 
			
		||||
	{0xFE10, 0xFE19}, {0xFE30, 0xFE52}, {0xFE54, 0xFE66},
 | 
			
		||||
	{0xFE68, 0xFE6B}, {0xFF01, 0xFF60}, {0xFFE0, 0xFFE6},
 | 
			
		||||
	{0x16FE0, 0x16FE3}, {0x17000, 0x187F7}, {0x18800, 0x18AF2},
 | 
			
		||||
	{0x1B000, 0x1B11E}, {0x1B150, 0x1B152}, {0x1B164, 0x1B167},
 | 
			
		||||
	{0x1B170, 0x1B2FB}, {0x1F004, 0x1F004}, {0x1F0CF, 0x1F0CF},
 | 
			
		||||
	{0x1F18E, 0x1F18E}, {0x1F191, 0x1F19A}, {0x1F200, 0x1F202},
 | 
			
		||||
	{0x1F210, 0x1F23B}, {0x1F240, 0x1F248}, {0x1F250, 0x1F251},
 | 
			
		||||
	{0x1F260, 0x1F265}, {0x1F300, 0x1F320}, {0x1F32D, 0x1F335},
 | 
			
		||||
	{0x1F337, 0x1F37C}, {0x1F37E, 0x1F393}, {0x1F3A0, 0x1F3CA},
 | 
			
		||||
	{0x1F3CF, 0x1F3D3}, {0x1F3E0, 0x1F3F0}, {0x1F3F4, 0x1F3F4},
 | 
			
		||||
	{0x1F3F8, 0x1F43E}, {0x1F440, 0x1F440}, {0x1F442, 0x1F4FC},
 | 
			
		||||
	{0x1F4FF, 0x1F53D}, {0x1F54B, 0x1F54E}, {0x1F550, 0x1F567},
 | 
			
		||||
	{0x1F57A, 0x1F57A}, {0x1F595, 0x1F596}, {0x1F5A4, 0x1F5A4},
 | 
			
		||||
	{0x1F5FB, 0x1F64F}, {0x1F680, 0x1F6C5}, {0x1F6CC, 0x1F6CC},
 | 
			
		||||
	{0x1F6D0, 0x1F6D2}, {0x1F6D5, 0x1F6D5}, {0x1F6EB, 0x1F6EC},
 | 
			
		||||
	{0x1F6F4, 0x1F6FA}, {0x1F7E0, 0x1F7EB}, {0x1F90D, 0x1F971},
 | 
			
		||||
	{0x1F973, 0x1F976}, {0x1F97A, 0x1F9A2}, {0x1F9A5, 0x1F9AA},
 | 
			
		||||
	{0x1F9AE, 0x1F9CA}, {0x1F9CD, 0x1F9FF}, {0x1FA70, 0x1FA73},
 | 
			
		||||
	{0x1FA78, 0x1FA7A}, {0x1FA80, 0x1FA82}, {0x1FA90, 0x1FA95},
 | 
			
		||||
	{0x3105, 0x312F}, {0x3131, 0x318E}, {0x3190, 0x31E3},
 | 
			
		||||
	{0x31F0, 0x321E}, {0x3220, 0x3247}, {0x3250, 0x4DBF},
 | 
			
		||||
	{0x4E00, 0xA48C}, {0xA490, 0xA4C6}, {0xA960, 0xA97C},
 | 
			
		||||
	{0xAC00, 0xD7A3}, {0xF900, 0xFAFF}, {0xFE10, 0xFE19},
 | 
			
		||||
	{0xFE30, 0xFE52}, {0xFE54, 0xFE66}, {0xFE68, 0xFE6B},
 | 
			
		||||
	{0xFF01, 0xFF60}, {0xFFE0, 0xFFE6}, {0x16FE0, 0x16FE4},
 | 
			
		||||
	{0x16FF0, 0x16FF1}, {0x17000, 0x187F7}, {0x18800, 0x18CD5},
 | 
			
		||||
	{0x18D00, 0x18D08}, {0x1B000, 0x1B11E}, {0x1B150, 0x1B152},
 | 
			
		||||
	{0x1B164, 0x1B167}, {0x1B170, 0x1B2FB}, {0x1F004, 0x1F004},
 | 
			
		||||
	{0x1F0CF, 0x1F0CF}, {0x1F18E, 0x1F18E}, {0x1F191, 0x1F19A},
 | 
			
		||||
	{0x1F200, 0x1F202}, {0x1F210, 0x1F23B}, {0x1F240, 0x1F248},
 | 
			
		||||
	{0x1F250, 0x1F251}, {0x1F260, 0x1F265}, {0x1F300, 0x1F320},
 | 
			
		||||
	{0x1F32D, 0x1F335}, {0x1F337, 0x1F37C}, {0x1F37E, 0x1F393},
 | 
			
		||||
	{0x1F3A0, 0x1F3CA}, {0x1F3CF, 0x1F3D3}, {0x1F3E0, 0x1F3F0},
 | 
			
		||||
	{0x1F3F4, 0x1F3F4}, {0x1F3F8, 0x1F43E}, {0x1F440, 0x1F440},
 | 
			
		||||
	{0x1F442, 0x1F4FC}, {0x1F4FF, 0x1F53D}, {0x1F54B, 0x1F54E},
 | 
			
		||||
	{0x1F550, 0x1F567}, {0x1F57A, 0x1F57A}, {0x1F595, 0x1F596},
 | 
			
		||||
	{0x1F5A4, 0x1F5A4}, {0x1F5FB, 0x1F64F}, {0x1F680, 0x1F6C5},
 | 
			
		||||
	{0x1F6CC, 0x1F6CC}, {0x1F6D0, 0x1F6D2}, {0x1F6D5, 0x1F6D7},
 | 
			
		||||
	{0x1F6EB, 0x1F6EC}, {0x1F6F4, 0x1F6FC}, {0x1F7E0, 0x1F7EB},
 | 
			
		||||
	{0x1F90C, 0x1F93A}, {0x1F93C, 0x1F945}, {0x1F947, 0x1F978},
 | 
			
		||||
	{0x1F97A, 0x1F9CB}, {0x1F9CD, 0x1F9FF}, {0x1FA70, 0x1FA74},
 | 
			
		||||
	{0x1FA78, 0x1FA7A}, {0x1FA80, 0x1FA86}, {0x1FA90, 0x1FAA8},
 | 
			
		||||
	{0x1FAB0, 0x1FAB6}, {0x1FAC0, 0x1FAC2}, {0x1FAD0, 0x1FAD6},
 | 
			
		||||
	{0x20000, 0x2FFFD}, {0x30000, 0x3FFFD},
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -151,7 +155,7 @@ var neutral = table{
 | 
			
		||||
	{0x0600, 0x061C}, {0x061E, 0x070D}, {0x070F, 0x074A},
 | 
			
		||||
	{0x074D, 0x07B1}, {0x07C0, 0x07FA}, {0x07FD, 0x082D},
 | 
			
		||||
	{0x0830, 0x083E}, {0x0840, 0x085B}, {0x085E, 0x085E},
 | 
			
		||||
	{0x0860, 0x086A}, {0x08A0, 0x08B4}, {0x08B6, 0x08BD},
 | 
			
		||||
	{0x0860, 0x086A}, {0x08A0, 0x08B4}, {0x08B6, 0x08C7},
 | 
			
		||||
	{0x08D3, 0x0983}, {0x0985, 0x098C}, {0x098F, 0x0990},
 | 
			
		||||
	{0x0993, 0x09A8}, {0x09AA, 0x09B0}, {0x09B2, 0x09B2},
 | 
			
		||||
	{0x09B6, 0x09B9}, {0x09BC, 0x09C4}, {0x09C7, 0x09C8},
 | 
			
		||||
@@ -170,7 +174,7 @@ var neutral = table{
 | 
			
		||||
	{0x0B05, 0x0B0C}, {0x0B0F, 0x0B10}, {0x0B13, 0x0B28},
 | 
			
		||||
	{0x0B2A, 0x0B30}, {0x0B32, 0x0B33}, {0x0B35, 0x0B39},
 | 
			
		||||
	{0x0B3C, 0x0B44}, {0x0B47, 0x0B48}, {0x0B4B, 0x0B4D},
 | 
			
		||||
	{0x0B56, 0x0B57}, {0x0B5C, 0x0B5D}, {0x0B5F, 0x0B63},
 | 
			
		||||
	{0x0B55, 0x0B57}, {0x0B5C, 0x0B5D}, {0x0B5F, 0x0B63},
 | 
			
		||||
	{0x0B66, 0x0B77}, {0x0B82, 0x0B83}, {0x0B85, 0x0B8A},
 | 
			
		||||
	{0x0B8E, 0x0B90}, {0x0B92, 0x0B95}, {0x0B99, 0x0B9A},
 | 
			
		||||
	{0x0B9C, 0x0B9C}, {0x0B9E, 0x0B9F}, {0x0BA3, 0x0BA4},
 | 
			
		||||
@@ -184,166 +188,169 @@ var neutral = table{
 | 
			
		||||
	{0x0C92, 0x0CA8}, {0x0CAA, 0x0CB3}, {0x0CB5, 0x0CB9},
 | 
			
		||||
	{0x0CBC, 0x0CC4}, {0x0CC6, 0x0CC8}, {0x0CCA, 0x0CCD},
 | 
			
		||||
	{0x0CD5, 0x0CD6}, {0x0CDE, 0x0CDE}, {0x0CE0, 0x0CE3},
 | 
			
		||||
	{0x0CE6, 0x0CEF}, {0x0CF1, 0x0CF2}, {0x0D00, 0x0D03},
 | 
			
		||||
	{0x0D05, 0x0D0C}, {0x0D0E, 0x0D10}, {0x0D12, 0x0D44},
 | 
			
		||||
	{0x0D46, 0x0D48}, {0x0D4A, 0x0D4F}, {0x0D54, 0x0D63},
 | 
			
		||||
	{0x0D66, 0x0D7F}, {0x0D82, 0x0D83}, {0x0D85, 0x0D96},
 | 
			
		||||
	{0x0D9A, 0x0DB1}, {0x0DB3, 0x0DBB}, {0x0DBD, 0x0DBD},
 | 
			
		||||
	{0x0DC0, 0x0DC6}, {0x0DCA, 0x0DCA}, {0x0DCF, 0x0DD4},
 | 
			
		||||
	{0x0DD6, 0x0DD6}, {0x0DD8, 0x0DDF}, {0x0DE6, 0x0DEF},
 | 
			
		||||
	{0x0DF2, 0x0DF4}, {0x0E01, 0x0E3A}, {0x0E3F, 0x0E5B},
 | 
			
		||||
	{0x0E81, 0x0E82}, {0x0E84, 0x0E84}, {0x0E86, 0x0E8A},
 | 
			
		||||
	{0x0E8C, 0x0EA3}, {0x0EA5, 0x0EA5}, {0x0EA7, 0x0EBD},
 | 
			
		||||
	{0x0EC0, 0x0EC4}, {0x0EC6, 0x0EC6}, {0x0EC8, 0x0ECD},
 | 
			
		||||
	{0x0ED0, 0x0ED9}, {0x0EDC, 0x0EDF}, {0x0F00, 0x0F47},
 | 
			
		||||
	{0x0F49, 0x0F6C}, {0x0F71, 0x0F97}, {0x0F99, 0x0FBC},
 | 
			
		||||
	{0x0FBE, 0x0FCC}, {0x0FCE, 0x0FDA}, {0x1000, 0x10C5},
 | 
			
		||||
	{0x10C7, 0x10C7}, {0x10CD, 0x10CD}, {0x10D0, 0x10FF},
 | 
			
		||||
	{0x1160, 0x1248}, {0x124A, 0x124D}, {0x1250, 0x1256},
 | 
			
		||||
	{0x1258, 0x1258}, {0x125A, 0x125D}, {0x1260, 0x1288},
 | 
			
		||||
	{0x128A, 0x128D}, {0x1290, 0x12B0}, {0x12B2, 0x12B5},
 | 
			
		||||
	{0x12B8, 0x12BE}, {0x12C0, 0x12C0}, {0x12C2, 0x12C5},
 | 
			
		||||
	{0x12C8, 0x12D6}, {0x12D8, 0x1310}, {0x1312, 0x1315},
 | 
			
		||||
	{0x1318, 0x135A}, {0x135D, 0x137C}, {0x1380, 0x1399},
 | 
			
		||||
	{0x13A0, 0x13F5}, {0x13F8, 0x13FD}, {0x1400, 0x169C},
 | 
			
		||||
	{0x16A0, 0x16F8}, {0x1700, 0x170C}, {0x170E, 0x1714},
 | 
			
		||||
	{0x1720, 0x1736}, {0x1740, 0x1753}, {0x1760, 0x176C},
 | 
			
		||||
	{0x176E, 0x1770}, {0x1772, 0x1773}, {0x1780, 0x17DD},
 | 
			
		||||
	{0x17E0, 0x17E9}, {0x17F0, 0x17F9}, {0x1800, 0x180E},
 | 
			
		||||
	{0x1810, 0x1819}, {0x1820, 0x1878}, {0x1880, 0x18AA},
 | 
			
		||||
	{0x18B0, 0x18F5}, {0x1900, 0x191E}, {0x1920, 0x192B},
 | 
			
		||||
	{0x1930, 0x193B}, {0x1940, 0x1940}, {0x1944, 0x196D},
 | 
			
		||||
	{0x1970, 0x1974}, {0x1980, 0x19AB}, {0x19B0, 0x19C9},
 | 
			
		||||
	{0x19D0, 0x19DA}, {0x19DE, 0x1A1B}, {0x1A1E, 0x1A5E},
 | 
			
		||||
	{0x1A60, 0x1A7C}, {0x1A7F, 0x1A89}, {0x1A90, 0x1A99},
 | 
			
		||||
	{0x1AA0, 0x1AAD}, {0x1AB0, 0x1ABE}, {0x1B00, 0x1B4B},
 | 
			
		||||
	{0x1B50, 0x1B7C}, {0x1B80, 0x1BF3}, {0x1BFC, 0x1C37},
 | 
			
		||||
	{0x1C3B, 0x1C49}, {0x1C4D, 0x1C88}, {0x1C90, 0x1CBA},
 | 
			
		||||
	{0x1CBD, 0x1CC7}, {0x1CD0, 0x1CFA}, {0x1D00, 0x1DF9},
 | 
			
		||||
	{0x1DFB, 0x1F15}, {0x1F18, 0x1F1D}, {0x1F20, 0x1F45},
 | 
			
		||||
	{0x1F48, 0x1F4D}, {0x1F50, 0x1F57}, {0x1F59, 0x1F59},
 | 
			
		||||
	{0x1F5B, 0x1F5B}, {0x1F5D, 0x1F5D}, {0x1F5F, 0x1F7D},
 | 
			
		||||
	{0x1F80, 0x1FB4}, {0x1FB6, 0x1FC4}, {0x1FC6, 0x1FD3},
 | 
			
		||||
	{0x1FD6, 0x1FDB}, {0x1FDD, 0x1FEF}, {0x1FF2, 0x1FF4},
 | 
			
		||||
	{0x1FF6, 0x1FFE}, {0x2000, 0x200F}, {0x2011, 0x2012},
 | 
			
		||||
	{0x2017, 0x2017}, {0x201A, 0x201B}, {0x201E, 0x201F},
 | 
			
		||||
	{0x2023, 0x2023}, {0x2028, 0x202F}, {0x2031, 0x2031},
 | 
			
		||||
	{0x2034, 0x2034}, {0x2036, 0x203A}, {0x203C, 0x203D},
 | 
			
		||||
	{0x203F, 0x2064}, {0x2066, 0x2071}, {0x2075, 0x207E},
 | 
			
		||||
	{0x2080, 0x2080}, {0x2085, 0x208E}, {0x2090, 0x209C},
 | 
			
		||||
	{0x20A0, 0x20A8}, {0x20AA, 0x20AB}, {0x20AD, 0x20BF},
 | 
			
		||||
	{0x20D0, 0x20F0}, {0x2100, 0x2102}, {0x2104, 0x2104},
 | 
			
		||||
	{0x2106, 0x2108}, {0x210A, 0x2112}, {0x2114, 0x2115},
 | 
			
		||||
	{0x2117, 0x2120}, {0x2123, 0x2125}, {0x2127, 0x212A},
 | 
			
		||||
	{0x212C, 0x2152}, {0x2155, 0x215A}, {0x215F, 0x215F},
 | 
			
		||||
	{0x216C, 0x216F}, {0x217A, 0x2188}, {0x218A, 0x218B},
 | 
			
		||||
	{0x219A, 0x21B7}, {0x21BA, 0x21D1}, {0x21D3, 0x21D3},
 | 
			
		||||
	{0x21D5, 0x21E6}, {0x21E8, 0x21FF}, {0x2201, 0x2201},
 | 
			
		||||
	{0x2204, 0x2206}, {0x2209, 0x220A}, {0x220C, 0x220E},
 | 
			
		||||
	{0x2210, 0x2210}, {0x2212, 0x2214}, {0x2216, 0x2219},
 | 
			
		||||
	{0x221B, 0x221C}, {0x2221, 0x2222}, {0x2224, 0x2224},
 | 
			
		||||
	{0x2226, 0x2226}, {0x222D, 0x222D}, {0x222F, 0x2233},
 | 
			
		||||
	{0x2238, 0x223B}, {0x223E, 0x2247}, {0x2249, 0x224B},
 | 
			
		||||
	{0x224D, 0x2251}, {0x2253, 0x225F}, {0x2262, 0x2263},
 | 
			
		||||
	{0x2268, 0x2269}, {0x226C, 0x226D}, {0x2270, 0x2281},
 | 
			
		||||
	{0x2284, 0x2285}, {0x2288, 0x2294}, {0x2296, 0x2298},
 | 
			
		||||
	{0x229A, 0x22A4}, {0x22A6, 0x22BE}, {0x22C0, 0x2311},
 | 
			
		||||
	{0x2313, 0x2319}, {0x231C, 0x2328}, {0x232B, 0x23E8},
 | 
			
		||||
	{0x23ED, 0x23EF}, {0x23F1, 0x23F2}, {0x23F4, 0x2426},
 | 
			
		||||
	{0x2440, 0x244A}, {0x24EA, 0x24EA}, {0x254C, 0x254F},
 | 
			
		||||
	{0x2574, 0x257F}, {0x2590, 0x2591}, {0x2596, 0x259F},
 | 
			
		||||
	{0x25A2, 0x25A2}, {0x25AA, 0x25B1}, {0x25B4, 0x25B5},
 | 
			
		||||
	{0x25B8, 0x25BB}, {0x25BE, 0x25BF}, {0x25C2, 0x25C5},
 | 
			
		||||
	{0x25C9, 0x25CA}, {0x25CC, 0x25CD}, {0x25D2, 0x25E1},
 | 
			
		||||
	{0x25E6, 0x25EE}, {0x25F0, 0x25FC}, {0x25FF, 0x2604},
 | 
			
		||||
	{0x2607, 0x2608}, {0x260A, 0x260D}, {0x2610, 0x2613},
 | 
			
		||||
	{0x2616, 0x261B}, {0x261D, 0x261D}, {0x261F, 0x263F},
 | 
			
		||||
	{0x2641, 0x2641}, {0x2643, 0x2647}, {0x2654, 0x265F},
 | 
			
		||||
	{0x2662, 0x2662}, {0x2666, 0x2666}, {0x266B, 0x266B},
 | 
			
		||||
	{0x266E, 0x266E}, {0x2670, 0x267E}, {0x2680, 0x2692},
 | 
			
		||||
	{0x2694, 0x269D}, {0x26A0, 0x26A0}, {0x26A2, 0x26A9},
 | 
			
		||||
	{0x26AC, 0x26BC}, {0x26C0, 0x26C3}, {0x26E2, 0x26E2},
 | 
			
		||||
	{0x26E4, 0x26E7}, {0x2700, 0x2704}, {0x2706, 0x2709},
 | 
			
		||||
	{0x270C, 0x2727}, {0x2729, 0x273C}, {0x273E, 0x274B},
 | 
			
		||||
	{0x274D, 0x274D}, {0x274F, 0x2752}, {0x2756, 0x2756},
 | 
			
		||||
	{0x2758, 0x2775}, {0x2780, 0x2794}, {0x2798, 0x27AF},
 | 
			
		||||
	{0x27B1, 0x27BE}, {0x27C0, 0x27E5}, {0x27EE, 0x2984},
 | 
			
		||||
	{0x2987, 0x2B1A}, {0x2B1D, 0x2B4F}, {0x2B51, 0x2B54},
 | 
			
		||||
	{0x2B5A, 0x2B73}, {0x2B76, 0x2B95}, {0x2B98, 0x2C2E},
 | 
			
		||||
	{0x2C30, 0x2C5E}, {0x2C60, 0x2CF3}, {0x2CF9, 0x2D25},
 | 
			
		||||
	{0x2D27, 0x2D27}, {0x2D2D, 0x2D2D}, {0x2D30, 0x2D67},
 | 
			
		||||
	{0x2D6F, 0x2D70}, {0x2D7F, 0x2D96}, {0x2DA0, 0x2DA6},
 | 
			
		||||
	{0x2DA8, 0x2DAE}, {0x2DB0, 0x2DB6}, {0x2DB8, 0x2DBE},
 | 
			
		||||
	{0x2DC0, 0x2DC6}, {0x2DC8, 0x2DCE}, {0x2DD0, 0x2DD6},
 | 
			
		||||
	{0x2DD8, 0x2DDE}, {0x2DE0, 0x2E4F}, {0x303F, 0x303F},
 | 
			
		||||
	{0x4DC0, 0x4DFF}, {0xA4D0, 0xA62B}, {0xA640, 0xA6F7},
 | 
			
		||||
	{0xA700, 0xA7BF}, {0xA7C2, 0xA7C6}, {0xA7F7, 0xA82B},
 | 
			
		||||
	{0xA830, 0xA839}, {0xA840, 0xA877}, {0xA880, 0xA8C5},
 | 
			
		||||
	{0xA8CE, 0xA8D9}, {0xA8E0, 0xA953}, {0xA95F, 0xA95F},
 | 
			
		||||
	{0xA980, 0xA9CD}, {0xA9CF, 0xA9D9}, {0xA9DE, 0xA9FE},
 | 
			
		||||
	{0xAA00, 0xAA36}, {0xAA40, 0xAA4D}, {0xAA50, 0xAA59},
 | 
			
		||||
	{0xAA5C, 0xAAC2}, {0xAADB, 0xAAF6}, {0xAB01, 0xAB06},
 | 
			
		||||
	{0xAB09, 0xAB0E}, {0xAB11, 0xAB16}, {0xAB20, 0xAB26},
 | 
			
		||||
	{0xAB28, 0xAB2E}, {0xAB30, 0xAB67}, {0xAB70, 0xABED},
 | 
			
		||||
	{0xABF0, 0xABF9}, {0xD7B0, 0xD7C6}, {0xD7CB, 0xD7FB},
 | 
			
		||||
	{0xD800, 0xDFFF}, {0xFB00, 0xFB06}, {0xFB13, 0xFB17},
 | 
			
		||||
	{0xFB1D, 0xFB36}, {0xFB38, 0xFB3C}, {0xFB3E, 0xFB3E},
 | 
			
		||||
	{0xFB40, 0xFB41}, {0xFB43, 0xFB44}, {0xFB46, 0xFBC1},
 | 
			
		||||
	{0xFBD3, 0xFD3F}, {0xFD50, 0xFD8F}, {0xFD92, 0xFDC7},
 | 
			
		||||
	{0xFDF0, 0xFDFD}, {0xFE20, 0xFE2F}, {0xFE70, 0xFE74},
 | 
			
		||||
	{0xFE76, 0xFEFC}, {0xFEFF, 0xFEFF}, {0xFFF9, 0xFFFC},
 | 
			
		||||
	{0x10000, 0x1000B}, {0x1000D, 0x10026}, {0x10028, 0x1003A},
 | 
			
		||||
	{0x1003C, 0x1003D}, {0x1003F, 0x1004D}, {0x10050, 0x1005D},
 | 
			
		||||
	{0x10080, 0x100FA}, {0x10100, 0x10102}, {0x10107, 0x10133},
 | 
			
		||||
	{0x10137, 0x1018E}, {0x10190, 0x1019B}, {0x101A0, 0x101A0},
 | 
			
		||||
	{0x101D0, 0x101FD}, {0x10280, 0x1029C}, {0x102A0, 0x102D0},
 | 
			
		||||
	{0x102E0, 0x102FB}, {0x10300, 0x10323}, {0x1032D, 0x1034A},
 | 
			
		||||
	{0x10350, 0x1037A}, {0x10380, 0x1039D}, {0x1039F, 0x103C3},
 | 
			
		||||
	{0x103C8, 0x103D5}, {0x10400, 0x1049D}, {0x104A0, 0x104A9},
 | 
			
		||||
	{0x104B0, 0x104D3}, {0x104D8, 0x104FB}, {0x10500, 0x10527},
 | 
			
		||||
	{0x10530, 0x10563}, {0x1056F, 0x1056F}, {0x10600, 0x10736},
 | 
			
		||||
	{0x10740, 0x10755}, {0x10760, 0x10767}, {0x10800, 0x10805},
 | 
			
		||||
	{0x10808, 0x10808}, {0x1080A, 0x10835}, {0x10837, 0x10838},
 | 
			
		||||
	{0x1083C, 0x1083C}, {0x1083F, 0x10855}, {0x10857, 0x1089E},
 | 
			
		||||
	{0x108A7, 0x108AF}, {0x108E0, 0x108F2}, {0x108F4, 0x108F5},
 | 
			
		||||
	{0x108FB, 0x1091B}, {0x1091F, 0x10939}, {0x1093F, 0x1093F},
 | 
			
		||||
	{0x10980, 0x109B7}, {0x109BC, 0x109CF}, {0x109D2, 0x10A03},
 | 
			
		||||
	{0x10A05, 0x10A06}, {0x10A0C, 0x10A13}, {0x10A15, 0x10A17},
 | 
			
		||||
	{0x10A19, 0x10A35}, {0x10A38, 0x10A3A}, {0x10A3F, 0x10A48},
 | 
			
		||||
	{0x10A50, 0x10A58}, {0x10A60, 0x10A9F}, {0x10AC0, 0x10AE6},
 | 
			
		||||
	{0x10AEB, 0x10AF6}, {0x10B00, 0x10B35}, {0x10B39, 0x10B55},
 | 
			
		||||
	{0x10B58, 0x10B72}, {0x10B78, 0x10B91}, {0x10B99, 0x10B9C},
 | 
			
		||||
	{0x10BA9, 0x10BAF}, {0x10C00, 0x10C48}, {0x10C80, 0x10CB2},
 | 
			
		||||
	{0x10CC0, 0x10CF2}, {0x10CFA, 0x10D27}, {0x10D30, 0x10D39},
 | 
			
		||||
	{0x10E60, 0x10E7E}, {0x10F00, 0x10F27}, {0x10F30, 0x10F59},
 | 
			
		||||
	{0x0CE6, 0x0CEF}, {0x0CF1, 0x0CF2}, {0x0D00, 0x0D0C},
 | 
			
		||||
	{0x0D0E, 0x0D10}, {0x0D12, 0x0D44}, {0x0D46, 0x0D48},
 | 
			
		||||
	{0x0D4A, 0x0D4F}, {0x0D54, 0x0D63}, {0x0D66, 0x0D7F},
 | 
			
		||||
	{0x0D81, 0x0D83}, {0x0D85, 0x0D96}, {0x0D9A, 0x0DB1},
 | 
			
		||||
	{0x0DB3, 0x0DBB}, {0x0DBD, 0x0DBD}, {0x0DC0, 0x0DC6},
 | 
			
		||||
	{0x0DCA, 0x0DCA}, {0x0DCF, 0x0DD4}, {0x0DD6, 0x0DD6},
 | 
			
		||||
	{0x0DD8, 0x0DDF}, {0x0DE6, 0x0DEF}, {0x0DF2, 0x0DF4},
 | 
			
		||||
	{0x0E01, 0x0E3A}, {0x0E3F, 0x0E5B}, {0x0E81, 0x0E82},
 | 
			
		||||
	{0x0E84, 0x0E84}, {0x0E86, 0x0E8A}, {0x0E8C, 0x0EA3},
 | 
			
		||||
	{0x0EA5, 0x0EA5}, {0x0EA7, 0x0EBD}, {0x0EC0, 0x0EC4},
 | 
			
		||||
	{0x0EC6, 0x0EC6}, {0x0EC8, 0x0ECD}, {0x0ED0, 0x0ED9},
 | 
			
		||||
	{0x0EDC, 0x0EDF}, {0x0F00, 0x0F47}, {0x0F49, 0x0F6C},
 | 
			
		||||
	{0x0F71, 0x0F97}, {0x0F99, 0x0FBC}, {0x0FBE, 0x0FCC},
 | 
			
		||||
	{0x0FCE, 0x0FDA}, {0x1000, 0x10C5}, {0x10C7, 0x10C7},
 | 
			
		||||
	{0x10CD, 0x10CD}, {0x10D0, 0x10FF}, {0x1160, 0x1248},
 | 
			
		||||
	{0x124A, 0x124D}, {0x1250, 0x1256}, {0x1258, 0x1258},
 | 
			
		||||
	{0x125A, 0x125D}, {0x1260, 0x1288}, {0x128A, 0x128D},
 | 
			
		||||
	{0x1290, 0x12B0}, {0x12B2, 0x12B5}, {0x12B8, 0x12BE},
 | 
			
		||||
	{0x12C0, 0x12C0}, {0x12C2, 0x12C5}, {0x12C8, 0x12D6},
 | 
			
		||||
	{0x12D8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135A},
 | 
			
		||||
	{0x135D, 0x137C}, {0x1380, 0x1399}, {0x13A0, 0x13F5},
 | 
			
		||||
	{0x13F8, 0x13FD}, {0x1400, 0x169C}, {0x16A0, 0x16F8},
 | 
			
		||||
	{0x1700, 0x170C}, {0x170E, 0x1714}, {0x1720, 0x1736},
 | 
			
		||||
	{0x1740, 0x1753}, {0x1760, 0x176C}, {0x176E, 0x1770},
 | 
			
		||||
	{0x1772, 0x1773}, {0x1780, 0x17DD}, {0x17E0, 0x17E9},
 | 
			
		||||
	{0x17F0, 0x17F9}, {0x1800, 0x180E}, {0x1810, 0x1819},
 | 
			
		||||
	{0x1820, 0x1878}, {0x1880, 0x18AA}, {0x18B0, 0x18F5},
 | 
			
		||||
	{0x1900, 0x191E}, {0x1920, 0x192B}, {0x1930, 0x193B},
 | 
			
		||||
	{0x1940, 0x1940}, {0x1944, 0x196D}, {0x1970, 0x1974},
 | 
			
		||||
	{0x1980, 0x19AB}, {0x19B0, 0x19C9}, {0x19D0, 0x19DA},
 | 
			
		||||
	{0x19DE, 0x1A1B}, {0x1A1E, 0x1A5E}, {0x1A60, 0x1A7C},
 | 
			
		||||
	{0x1A7F, 0x1A89}, {0x1A90, 0x1A99}, {0x1AA0, 0x1AAD},
 | 
			
		||||
	{0x1AB0, 0x1AC0}, {0x1B00, 0x1B4B}, {0x1B50, 0x1B7C},
 | 
			
		||||
	{0x1B80, 0x1BF3}, {0x1BFC, 0x1C37}, {0x1C3B, 0x1C49},
 | 
			
		||||
	{0x1C4D, 0x1C88}, {0x1C90, 0x1CBA}, {0x1CBD, 0x1CC7},
 | 
			
		||||
	{0x1CD0, 0x1CFA}, {0x1D00, 0x1DF9}, {0x1DFB, 0x1F15},
 | 
			
		||||
	{0x1F18, 0x1F1D}, {0x1F20, 0x1F45}, {0x1F48, 0x1F4D},
 | 
			
		||||
	{0x1F50, 0x1F57}, {0x1F59, 0x1F59}, {0x1F5B, 0x1F5B},
 | 
			
		||||
	{0x1F5D, 0x1F5D}, {0x1F5F, 0x1F7D}, {0x1F80, 0x1FB4},
 | 
			
		||||
	{0x1FB6, 0x1FC4}, {0x1FC6, 0x1FD3}, {0x1FD6, 0x1FDB},
 | 
			
		||||
	{0x1FDD, 0x1FEF}, {0x1FF2, 0x1FF4}, {0x1FF6, 0x1FFE},
 | 
			
		||||
	{0x2000, 0x200F}, {0x2011, 0x2012}, {0x2017, 0x2017},
 | 
			
		||||
	{0x201A, 0x201B}, {0x201E, 0x201F}, {0x2023, 0x2023},
 | 
			
		||||
	{0x2028, 0x202F}, {0x2031, 0x2031}, {0x2034, 0x2034},
 | 
			
		||||
	{0x2036, 0x203A}, {0x203C, 0x203D}, {0x203F, 0x2064},
 | 
			
		||||
	{0x2066, 0x2071}, {0x2075, 0x207E}, {0x2080, 0x2080},
 | 
			
		||||
	{0x2085, 0x208E}, {0x2090, 0x209C}, {0x20A0, 0x20A8},
 | 
			
		||||
	{0x20AA, 0x20AB}, {0x20AD, 0x20BF}, {0x20D0, 0x20F0},
 | 
			
		||||
	{0x2100, 0x2102}, {0x2104, 0x2104}, {0x2106, 0x2108},
 | 
			
		||||
	{0x210A, 0x2112}, {0x2114, 0x2115}, {0x2117, 0x2120},
 | 
			
		||||
	{0x2123, 0x2125}, {0x2127, 0x212A}, {0x212C, 0x2152},
 | 
			
		||||
	{0x2155, 0x215A}, {0x215F, 0x215F}, {0x216C, 0x216F},
 | 
			
		||||
	{0x217A, 0x2188}, {0x218A, 0x218B}, {0x219A, 0x21B7},
 | 
			
		||||
	{0x21BA, 0x21D1}, {0x21D3, 0x21D3}, {0x21D5, 0x21E6},
 | 
			
		||||
	{0x21E8, 0x21FF}, {0x2201, 0x2201}, {0x2204, 0x2206},
 | 
			
		||||
	{0x2209, 0x220A}, {0x220C, 0x220E}, {0x2210, 0x2210},
 | 
			
		||||
	{0x2212, 0x2214}, {0x2216, 0x2219}, {0x221B, 0x221C},
 | 
			
		||||
	{0x2221, 0x2222}, {0x2224, 0x2224}, {0x2226, 0x2226},
 | 
			
		||||
	{0x222D, 0x222D}, {0x222F, 0x2233}, {0x2238, 0x223B},
 | 
			
		||||
	{0x223E, 0x2247}, {0x2249, 0x224B}, {0x224D, 0x2251},
 | 
			
		||||
	{0x2253, 0x225F}, {0x2262, 0x2263}, {0x2268, 0x2269},
 | 
			
		||||
	{0x226C, 0x226D}, {0x2270, 0x2281}, {0x2284, 0x2285},
 | 
			
		||||
	{0x2288, 0x2294}, {0x2296, 0x2298}, {0x229A, 0x22A4},
 | 
			
		||||
	{0x22A6, 0x22BE}, {0x22C0, 0x2311}, {0x2313, 0x2319},
 | 
			
		||||
	{0x231C, 0x2328}, {0x232B, 0x23E8}, {0x23ED, 0x23EF},
 | 
			
		||||
	{0x23F1, 0x23F2}, {0x23F4, 0x2426}, {0x2440, 0x244A},
 | 
			
		||||
	{0x24EA, 0x24EA}, {0x254C, 0x254F}, {0x2574, 0x257F},
 | 
			
		||||
	{0x2590, 0x2591}, {0x2596, 0x259F}, {0x25A2, 0x25A2},
 | 
			
		||||
	{0x25AA, 0x25B1}, {0x25B4, 0x25B5}, {0x25B8, 0x25BB},
 | 
			
		||||
	{0x25BE, 0x25BF}, {0x25C2, 0x25C5}, {0x25C9, 0x25CA},
 | 
			
		||||
	{0x25CC, 0x25CD}, {0x25D2, 0x25E1}, {0x25E6, 0x25EE},
 | 
			
		||||
	{0x25F0, 0x25FC}, {0x25FF, 0x2604}, {0x2607, 0x2608},
 | 
			
		||||
	{0x260A, 0x260D}, {0x2610, 0x2613}, {0x2616, 0x261B},
 | 
			
		||||
	{0x261D, 0x261D}, {0x261F, 0x263F}, {0x2641, 0x2641},
 | 
			
		||||
	{0x2643, 0x2647}, {0x2654, 0x265F}, {0x2662, 0x2662},
 | 
			
		||||
	{0x2666, 0x2666}, {0x266B, 0x266B}, {0x266E, 0x266E},
 | 
			
		||||
	{0x2670, 0x267E}, {0x2680, 0x2692}, {0x2694, 0x269D},
 | 
			
		||||
	{0x26A0, 0x26A0}, {0x26A2, 0x26A9}, {0x26AC, 0x26BC},
 | 
			
		||||
	{0x26C0, 0x26C3}, {0x26E2, 0x26E2}, {0x26E4, 0x26E7},
 | 
			
		||||
	{0x2700, 0x2704}, {0x2706, 0x2709}, {0x270C, 0x2727},
 | 
			
		||||
	{0x2729, 0x273C}, {0x273E, 0x274B}, {0x274D, 0x274D},
 | 
			
		||||
	{0x274F, 0x2752}, {0x2756, 0x2756}, {0x2758, 0x2775},
 | 
			
		||||
	{0x2780, 0x2794}, {0x2798, 0x27AF}, {0x27B1, 0x27BE},
 | 
			
		||||
	{0x27C0, 0x27E5}, {0x27EE, 0x2984}, {0x2987, 0x2B1A},
 | 
			
		||||
	{0x2B1D, 0x2B4F}, {0x2B51, 0x2B54}, {0x2B5A, 0x2B73},
 | 
			
		||||
	{0x2B76, 0x2B95}, {0x2B97, 0x2C2E}, {0x2C30, 0x2C5E},
 | 
			
		||||
	{0x2C60, 0x2CF3}, {0x2CF9, 0x2D25}, {0x2D27, 0x2D27},
 | 
			
		||||
	{0x2D2D, 0x2D2D}, {0x2D30, 0x2D67}, {0x2D6F, 0x2D70},
 | 
			
		||||
	{0x2D7F, 0x2D96}, {0x2DA0, 0x2DA6}, {0x2DA8, 0x2DAE},
 | 
			
		||||
	{0x2DB0, 0x2DB6}, {0x2DB8, 0x2DBE}, {0x2DC0, 0x2DC6},
 | 
			
		||||
	{0x2DC8, 0x2DCE}, {0x2DD0, 0x2DD6}, {0x2DD8, 0x2DDE},
 | 
			
		||||
	{0x2DE0, 0x2E52}, {0x303F, 0x303F}, {0x4DC0, 0x4DFF},
 | 
			
		||||
	{0xA4D0, 0xA62B}, {0xA640, 0xA6F7}, {0xA700, 0xA7BF},
 | 
			
		||||
	{0xA7C2, 0xA7CA}, {0xA7F5, 0xA82C}, {0xA830, 0xA839},
 | 
			
		||||
	{0xA840, 0xA877}, {0xA880, 0xA8C5}, {0xA8CE, 0xA8D9},
 | 
			
		||||
	{0xA8E0, 0xA953}, {0xA95F, 0xA95F}, {0xA980, 0xA9CD},
 | 
			
		||||
	{0xA9CF, 0xA9D9}, {0xA9DE, 0xA9FE}, {0xAA00, 0xAA36},
 | 
			
		||||
	{0xAA40, 0xAA4D}, {0xAA50, 0xAA59}, {0xAA5C, 0xAAC2},
 | 
			
		||||
	{0xAADB, 0xAAF6}, {0xAB01, 0xAB06}, {0xAB09, 0xAB0E},
 | 
			
		||||
	{0xAB11, 0xAB16}, {0xAB20, 0xAB26}, {0xAB28, 0xAB2E},
 | 
			
		||||
	{0xAB30, 0xAB6B}, {0xAB70, 0xABED}, {0xABF0, 0xABF9},
 | 
			
		||||
	{0xD7B0, 0xD7C6}, {0xD7CB, 0xD7FB}, {0xD800, 0xDFFF},
 | 
			
		||||
	{0xFB00, 0xFB06}, {0xFB13, 0xFB17}, {0xFB1D, 0xFB36},
 | 
			
		||||
	{0xFB38, 0xFB3C}, {0xFB3E, 0xFB3E}, {0xFB40, 0xFB41},
 | 
			
		||||
	{0xFB43, 0xFB44}, {0xFB46, 0xFBC1}, {0xFBD3, 0xFD3F},
 | 
			
		||||
	{0xFD50, 0xFD8F}, {0xFD92, 0xFDC7}, {0xFDF0, 0xFDFD},
 | 
			
		||||
	{0xFE20, 0xFE2F}, {0xFE70, 0xFE74}, {0xFE76, 0xFEFC},
 | 
			
		||||
	{0xFEFF, 0xFEFF}, {0xFFF9, 0xFFFC}, {0x10000, 0x1000B},
 | 
			
		||||
	{0x1000D, 0x10026}, {0x10028, 0x1003A}, {0x1003C, 0x1003D},
 | 
			
		||||
	{0x1003F, 0x1004D}, {0x10050, 0x1005D}, {0x10080, 0x100FA},
 | 
			
		||||
	{0x10100, 0x10102}, {0x10107, 0x10133}, {0x10137, 0x1018E},
 | 
			
		||||
	{0x10190, 0x1019C}, {0x101A0, 0x101A0}, {0x101D0, 0x101FD},
 | 
			
		||||
	{0x10280, 0x1029C}, {0x102A0, 0x102D0}, {0x102E0, 0x102FB},
 | 
			
		||||
	{0x10300, 0x10323}, {0x1032D, 0x1034A}, {0x10350, 0x1037A},
 | 
			
		||||
	{0x10380, 0x1039D}, {0x1039F, 0x103C3}, {0x103C8, 0x103D5},
 | 
			
		||||
	{0x10400, 0x1049D}, {0x104A0, 0x104A9}, {0x104B0, 0x104D3},
 | 
			
		||||
	{0x104D8, 0x104FB}, {0x10500, 0x10527}, {0x10530, 0x10563},
 | 
			
		||||
	{0x1056F, 0x1056F}, {0x10600, 0x10736}, {0x10740, 0x10755},
 | 
			
		||||
	{0x10760, 0x10767}, {0x10800, 0x10805}, {0x10808, 0x10808},
 | 
			
		||||
	{0x1080A, 0x10835}, {0x10837, 0x10838}, {0x1083C, 0x1083C},
 | 
			
		||||
	{0x1083F, 0x10855}, {0x10857, 0x1089E}, {0x108A7, 0x108AF},
 | 
			
		||||
	{0x108E0, 0x108F2}, {0x108F4, 0x108F5}, {0x108FB, 0x1091B},
 | 
			
		||||
	{0x1091F, 0x10939}, {0x1093F, 0x1093F}, {0x10980, 0x109B7},
 | 
			
		||||
	{0x109BC, 0x109CF}, {0x109D2, 0x10A03}, {0x10A05, 0x10A06},
 | 
			
		||||
	{0x10A0C, 0x10A13}, {0x10A15, 0x10A17}, {0x10A19, 0x10A35},
 | 
			
		||||
	{0x10A38, 0x10A3A}, {0x10A3F, 0x10A48}, {0x10A50, 0x10A58},
 | 
			
		||||
	{0x10A60, 0x10A9F}, {0x10AC0, 0x10AE6}, {0x10AEB, 0x10AF6},
 | 
			
		||||
	{0x10B00, 0x10B35}, {0x10B39, 0x10B55}, {0x10B58, 0x10B72},
 | 
			
		||||
	{0x10B78, 0x10B91}, {0x10B99, 0x10B9C}, {0x10BA9, 0x10BAF},
 | 
			
		||||
	{0x10C00, 0x10C48}, {0x10C80, 0x10CB2}, {0x10CC0, 0x10CF2},
 | 
			
		||||
	{0x10CFA, 0x10D27}, {0x10D30, 0x10D39}, {0x10E60, 0x10E7E},
 | 
			
		||||
	{0x10E80, 0x10EA9}, {0x10EAB, 0x10EAD}, {0x10EB0, 0x10EB1},
 | 
			
		||||
	{0x10F00, 0x10F27}, {0x10F30, 0x10F59}, {0x10FB0, 0x10FCB},
 | 
			
		||||
	{0x10FE0, 0x10FF6}, {0x11000, 0x1104D}, {0x11052, 0x1106F},
 | 
			
		||||
	{0x1107F, 0x110C1}, {0x110CD, 0x110CD}, {0x110D0, 0x110E8},
 | 
			
		||||
	{0x110F0, 0x110F9}, {0x11100, 0x11134}, {0x11136, 0x11146},
 | 
			
		||||
	{0x11150, 0x11176}, {0x11180, 0x111CD}, {0x111D0, 0x111DF},
 | 
			
		||||
	{0x111E1, 0x111F4}, {0x11200, 0x11211}, {0x11213, 0x1123E},
 | 
			
		||||
	{0x11280, 0x11286}, {0x11288, 0x11288}, {0x1128A, 0x1128D},
 | 
			
		||||
	{0x1128F, 0x1129D}, {0x1129F, 0x112A9}, {0x112B0, 0x112EA},
 | 
			
		||||
	{0x112F0, 0x112F9}, {0x11300, 0x11303}, {0x11305, 0x1130C},
 | 
			
		||||
	{0x1130F, 0x11310}, {0x11313, 0x11328}, {0x1132A, 0x11330},
 | 
			
		||||
	{0x11332, 0x11333}, {0x11335, 0x11339}, {0x1133B, 0x11344},
 | 
			
		||||
	{0x11347, 0x11348}, {0x1134B, 0x1134D}, {0x11350, 0x11350},
 | 
			
		||||
	{0x11357, 0x11357}, {0x1135D, 0x11363}, {0x11366, 0x1136C},
 | 
			
		||||
	{0x11370, 0x11374}, {0x11400, 0x11459}, {0x1145B, 0x1145B},
 | 
			
		||||
	{0x1145D, 0x1145F}, {0x11480, 0x114C7}, {0x114D0, 0x114D9},
 | 
			
		||||
	{0x11580, 0x115B5}, {0x115B8, 0x115DD}, {0x11600, 0x11644},
 | 
			
		||||
	{0x11650, 0x11659}, {0x11660, 0x1166C}, {0x11680, 0x116B8},
 | 
			
		||||
	{0x116C0, 0x116C9}, {0x11700, 0x1171A}, {0x1171D, 0x1172B},
 | 
			
		||||
	{0x11730, 0x1173F}, {0x11800, 0x1183B}, {0x118A0, 0x118F2},
 | 
			
		||||
	{0x118FF, 0x118FF}, {0x119A0, 0x119A7}, {0x119AA, 0x119D7},
 | 
			
		||||
	{0x119DA, 0x119E4}, {0x11A00, 0x11A47}, {0x11A50, 0x11AA2},
 | 
			
		||||
	{0x11AC0, 0x11AF8}, {0x11C00, 0x11C08}, {0x11C0A, 0x11C36},
 | 
			
		||||
	{0x11C38, 0x11C45}, {0x11C50, 0x11C6C}, {0x11C70, 0x11C8F},
 | 
			
		||||
	{0x11C92, 0x11CA7}, {0x11CA9, 0x11CB6}, {0x11D00, 0x11D06},
 | 
			
		||||
	{0x11D08, 0x11D09}, {0x11D0B, 0x11D36}, {0x11D3A, 0x11D3A},
 | 
			
		||||
	{0x11D3C, 0x11D3D}, {0x11D3F, 0x11D47}, {0x11D50, 0x11D59},
 | 
			
		||||
	{0x11D60, 0x11D65}, {0x11D67, 0x11D68}, {0x11D6A, 0x11D8E},
 | 
			
		||||
	{0x11D90, 0x11D91}, {0x11D93, 0x11D98}, {0x11DA0, 0x11DA9},
 | 
			
		||||
	{0x11EE0, 0x11EF8}, {0x11FC0, 0x11FF1}, {0x11FFF, 0x12399},
 | 
			
		||||
	{0x110F0, 0x110F9}, {0x11100, 0x11134}, {0x11136, 0x11147},
 | 
			
		||||
	{0x11150, 0x11176}, {0x11180, 0x111DF}, {0x111E1, 0x111F4},
 | 
			
		||||
	{0x11200, 0x11211}, {0x11213, 0x1123E}, {0x11280, 0x11286},
 | 
			
		||||
	{0x11288, 0x11288}, {0x1128A, 0x1128D}, {0x1128F, 0x1129D},
 | 
			
		||||
	{0x1129F, 0x112A9}, {0x112B0, 0x112EA}, {0x112F0, 0x112F9},
 | 
			
		||||
	{0x11300, 0x11303}, {0x11305, 0x1130C}, {0x1130F, 0x11310},
 | 
			
		||||
	{0x11313, 0x11328}, {0x1132A, 0x11330}, {0x11332, 0x11333},
 | 
			
		||||
	{0x11335, 0x11339}, {0x1133B, 0x11344}, {0x11347, 0x11348},
 | 
			
		||||
	{0x1134B, 0x1134D}, {0x11350, 0x11350}, {0x11357, 0x11357},
 | 
			
		||||
	{0x1135D, 0x11363}, {0x11366, 0x1136C}, {0x11370, 0x11374},
 | 
			
		||||
	{0x11400, 0x1145B}, {0x1145D, 0x11461}, {0x11480, 0x114C7},
 | 
			
		||||
	{0x114D0, 0x114D9}, {0x11580, 0x115B5}, {0x115B8, 0x115DD},
 | 
			
		||||
	{0x11600, 0x11644}, {0x11650, 0x11659}, {0x11660, 0x1166C},
 | 
			
		||||
	{0x11680, 0x116B8}, {0x116C0, 0x116C9}, {0x11700, 0x1171A},
 | 
			
		||||
	{0x1171D, 0x1172B}, {0x11730, 0x1173F}, {0x11800, 0x1183B},
 | 
			
		||||
	{0x118A0, 0x118F2}, {0x118FF, 0x11906}, {0x11909, 0x11909},
 | 
			
		||||
	{0x1190C, 0x11913}, {0x11915, 0x11916}, {0x11918, 0x11935},
 | 
			
		||||
	{0x11937, 0x11938}, {0x1193B, 0x11946}, {0x11950, 0x11959},
 | 
			
		||||
	{0x119A0, 0x119A7}, {0x119AA, 0x119D7}, {0x119DA, 0x119E4},
 | 
			
		||||
	{0x11A00, 0x11A47}, {0x11A50, 0x11AA2}, {0x11AC0, 0x11AF8},
 | 
			
		||||
	{0x11C00, 0x11C08}, {0x11C0A, 0x11C36}, {0x11C38, 0x11C45},
 | 
			
		||||
	{0x11C50, 0x11C6C}, {0x11C70, 0x11C8F}, {0x11C92, 0x11CA7},
 | 
			
		||||
	{0x11CA9, 0x11CB6}, {0x11D00, 0x11D06}, {0x11D08, 0x11D09},
 | 
			
		||||
	{0x11D0B, 0x11D36}, {0x11D3A, 0x11D3A}, {0x11D3C, 0x11D3D},
 | 
			
		||||
	{0x11D3F, 0x11D47}, {0x11D50, 0x11D59}, {0x11D60, 0x11D65},
 | 
			
		||||
	{0x11D67, 0x11D68}, {0x11D6A, 0x11D8E}, {0x11D90, 0x11D91},
 | 
			
		||||
	{0x11D93, 0x11D98}, {0x11DA0, 0x11DA9}, {0x11EE0, 0x11EF8},
 | 
			
		||||
	{0x11FB0, 0x11FB0}, {0x11FC0, 0x11FF1}, {0x11FFF, 0x12399},
 | 
			
		||||
	{0x12400, 0x1246E}, {0x12470, 0x12474}, {0x12480, 0x12543},
 | 
			
		||||
	{0x13000, 0x1342E}, {0x13430, 0x13438}, {0x14400, 0x14646},
 | 
			
		||||
	{0x16800, 0x16A38}, {0x16A40, 0x16A5E}, {0x16A60, 0x16A69},
 | 
			
		||||
@@ -382,20 +389,22 @@ var neutral = table{
 | 
			
		||||
	{0x1EEA5, 0x1EEA9}, {0x1EEAB, 0x1EEBB}, {0x1EEF0, 0x1EEF1},
 | 
			
		||||
	{0x1F000, 0x1F003}, {0x1F005, 0x1F02B}, {0x1F030, 0x1F093},
 | 
			
		||||
	{0x1F0A0, 0x1F0AE}, {0x1F0B1, 0x1F0BF}, {0x1F0C1, 0x1F0CE},
 | 
			
		||||
	{0x1F0D1, 0x1F0F5}, {0x1F10B, 0x1F10C}, {0x1F12E, 0x1F12F},
 | 
			
		||||
	{0x1F16A, 0x1F16C}, {0x1F1E6, 0x1F1FF}, {0x1F321, 0x1F32C},
 | 
			
		||||
	{0x1F336, 0x1F336}, {0x1F37D, 0x1F37D}, {0x1F394, 0x1F39F},
 | 
			
		||||
	{0x1F3CB, 0x1F3CE}, {0x1F3D4, 0x1F3DF}, {0x1F3F1, 0x1F3F3},
 | 
			
		||||
	{0x1F3F5, 0x1F3F7}, {0x1F43F, 0x1F43F}, {0x1F441, 0x1F441},
 | 
			
		||||
	{0x1F4FD, 0x1F4FE}, {0x1F53E, 0x1F54A}, {0x1F54F, 0x1F54F},
 | 
			
		||||
	{0x1F568, 0x1F579}, {0x1F57B, 0x1F594}, {0x1F597, 0x1F5A3},
 | 
			
		||||
	{0x1F5A5, 0x1F5FA}, {0x1F650, 0x1F67F}, {0x1F6C6, 0x1F6CB},
 | 
			
		||||
	{0x1F6CD, 0x1F6CF}, {0x1F6D3, 0x1F6D4}, {0x1F6E0, 0x1F6EA},
 | 
			
		||||
	{0x1F6F0, 0x1F6F3}, {0x1F700, 0x1F773}, {0x1F780, 0x1F7D8},
 | 
			
		||||
	{0x1F800, 0x1F80B}, {0x1F810, 0x1F847}, {0x1F850, 0x1F859},
 | 
			
		||||
	{0x1F860, 0x1F887}, {0x1F890, 0x1F8AD}, {0x1F900, 0x1F90B},
 | 
			
		||||
	{0x1FA00, 0x1FA53}, {0x1FA60, 0x1FA6D}, {0xE0001, 0xE0001},
 | 
			
		||||
	{0xE0020, 0xE007F},
 | 
			
		||||
	{0x1F0D1, 0x1F0F5}, {0x1F10B, 0x1F10F}, {0x1F12E, 0x1F12F},
 | 
			
		||||
	{0x1F16A, 0x1F16F}, {0x1F1AD, 0x1F1AD}, {0x1F1E6, 0x1F1FF},
 | 
			
		||||
	{0x1F321, 0x1F32C}, {0x1F336, 0x1F336}, {0x1F37D, 0x1F37D},
 | 
			
		||||
	{0x1F394, 0x1F39F}, {0x1F3CB, 0x1F3CE}, {0x1F3D4, 0x1F3DF},
 | 
			
		||||
	{0x1F3F1, 0x1F3F3}, {0x1F3F5, 0x1F3F7}, {0x1F43F, 0x1F43F},
 | 
			
		||||
	{0x1F441, 0x1F441}, {0x1F4FD, 0x1F4FE}, {0x1F53E, 0x1F54A},
 | 
			
		||||
	{0x1F54F, 0x1F54F}, {0x1F568, 0x1F579}, {0x1F57B, 0x1F594},
 | 
			
		||||
	{0x1F597, 0x1F5A3}, {0x1F5A5, 0x1F5FA}, {0x1F650, 0x1F67F},
 | 
			
		||||
	{0x1F6C6, 0x1F6CB}, {0x1F6CD, 0x1F6CF}, {0x1F6D3, 0x1F6D4},
 | 
			
		||||
	{0x1F6E0, 0x1F6EA}, {0x1F6F0, 0x1F6F3}, {0x1F700, 0x1F773},
 | 
			
		||||
	{0x1F780, 0x1F7D8}, {0x1F800, 0x1F80B}, {0x1F810, 0x1F847},
 | 
			
		||||
	{0x1F850, 0x1F859}, {0x1F860, 0x1F887}, {0x1F890, 0x1F8AD},
 | 
			
		||||
	{0x1F8B0, 0x1F8B1}, {0x1F900, 0x1F90B}, {0x1F93B, 0x1F93B},
 | 
			
		||||
	{0x1F946, 0x1F946}, {0x1FA00, 0x1FA53}, {0x1FA60, 0x1FA6D},
 | 
			
		||||
	{0x1FB00, 0x1FB92}, {0x1FB94, 0x1FBCA}, {0x1FBF0, 0x1FBF9},
 | 
			
		||||
	{0xE0001, 0xE0001}, {0xE0020, 0xE007F},
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var emoji = table{
 | 
			
		||||
@@ -423,5 +432,6 @@ var emoji = table{
 | 
			
		||||
	{0x1F546, 0x1F64F}, {0x1F680, 0x1F6FF}, {0x1F774, 0x1F77F},
 | 
			
		||||
	{0x1F7D5, 0x1F7FF}, {0x1F80C, 0x1F80F}, {0x1F848, 0x1F84F},
 | 
			
		||||
	{0x1F85A, 0x1F85F}, {0x1F888, 0x1F88F}, {0x1F8AE, 0x1F8FF},
 | 
			
		||||
	{0x1F90C, 0x1F93A}, {0x1F93C, 0x1F945}, {0x1F947, 0x1FFFD},
 | 
			
		||||
	{0x1F90C, 0x1F93A}, {0x1F93C, 0x1F945}, {0x1F947, 0x1FAFF},
 | 
			
		||||
	{0x1FC00, 0x1FFFD},
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										21
									
								
								vendor/github.com/mgechev/revive/formatter/friendly.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								vendor/github.com/mgechev/revive/formatter/friendly.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -10,11 +10,6 @@ import (
 | 
			
		||||
	"github.com/olekukonko/tablewriter"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	errorEmoji   = color.RedString("✘")
 | 
			
		||||
	warningEmoji = color.YellowString("⚠")
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var newLines = map[rune]bool{
 | 
			
		||||
	0x000A: true,
 | 
			
		||||
	0x000B: true,
 | 
			
		||||
@@ -25,6 +20,14 @@ var newLines = map[rune]bool{
 | 
			
		||||
	0x2029: true,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getErrorEmoji() string {
 | 
			
		||||
	return color.RedString("✘")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getWarningEmoji() string {
 | 
			
		||||
	return color.YellowString("⚠")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Friendly is an implementation of the Formatter interface
 | 
			
		||||
// which formats the errors to JSON.
 | 
			
		||||
type Friendly struct {
 | 
			
		||||
@@ -68,9 +71,9 @@ func (f *Friendly) printFriendlyFailure(failure lint.Failure, severity lint.Seve
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *Friendly) printHeaderRow(failure lint.Failure, severity lint.Severity) {
 | 
			
		||||
	emoji := warningEmoji
 | 
			
		||||
	emoji := getWarningEmoji()
 | 
			
		||||
	if severity == lint.SeverityError {
 | 
			
		||||
		emoji = errorEmoji
 | 
			
		||||
		emoji = getErrorEmoji()
 | 
			
		||||
	}
 | 
			
		||||
	fmt.Print(f.table([][]string{{emoji, "https://revive.run/r#" + failure.RuleName, color.GreenString(failure.Failure)}}))
 | 
			
		||||
}
 | 
			
		||||
@@ -85,9 +88,9 @@ type statEntry struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *Friendly) printSummary(errors, warnings int) {
 | 
			
		||||
	emoji := warningEmoji
 | 
			
		||||
	emoji := getWarningEmoji()
 | 
			
		||||
	if errors > 0 {
 | 
			
		||||
		emoji = errorEmoji
 | 
			
		||||
		emoji = getErrorEmoji()
 | 
			
		||||
	}
 | 
			
		||||
	problemsLabel := "problems"
 | 
			
		||||
	if errors+warnings == 1 {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/github.com/mgechev/revive/rule/cognitive-complexity.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/mgechev/revive/rule/cognitive-complexity.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -52,7 +52,7 @@ type cognitiveComplexityLinter struct {
 | 
			
		||||
func (w cognitiveComplexityLinter) lint() {
 | 
			
		||||
	f := w.file
 | 
			
		||||
	for _, decl := range f.AST.Decls {
 | 
			
		||||
		if fn, ok := decl.(*ast.FuncDecl); ok {
 | 
			
		||||
		if fn, ok := decl.(*ast.FuncDecl); ok && fn.Body != nil {
 | 
			
		||||
			v := cognitiveComplexityVisitor{}
 | 
			
		||||
			c := v.subTreeComplexity(fn.Body)
 | 
			
		||||
			if c > w.maxComplexity {
 | 
			
		||||
@@ -109,7 +109,7 @@ func (v *cognitiveComplexityVisitor) Visit(n ast.Node) ast.Visitor {
 | 
			
		||||
		return nil // skip visiting binexp sub-tree (already visited by binExpComplexity)
 | 
			
		||||
	case *ast.BranchStmt:
 | 
			
		||||
		if n.Label != nil {
 | 
			
		||||
			v.complexity += 1
 | 
			
		||||
			v.complexity++
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	// TODO handle (at least) direct recursion
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										137
									
								
								vendor/github.com/mgechev/revive/rule/defer.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										137
									
								
								vendor/github.com/mgechev/revive/rule/defer.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,137 @@
 | 
			
		||||
package rule
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"go/ast"
 | 
			
		||||
 | 
			
		||||
	"github.com/mgechev/revive/lint"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// DeferRule lints unused params in functions.
 | 
			
		||||
type DeferRule struct{}
 | 
			
		||||
 | 
			
		||||
// Apply applies the rule to given file.
 | 
			
		||||
func (r *DeferRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
 | 
			
		||||
	allow := r.allowFromArgs(arguments)
 | 
			
		||||
 | 
			
		||||
	var failures []lint.Failure
 | 
			
		||||
	onFailure := func(failure lint.Failure) {
 | 
			
		||||
		failures = append(failures, failure)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	w := lintDeferRule{onFailure: onFailure, allow: allow}
 | 
			
		||||
 | 
			
		||||
	ast.Walk(w, file.AST)
 | 
			
		||||
 | 
			
		||||
	return failures
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Name returns the rule name.
 | 
			
		||||
func (r *DeferRule) Name() string {
 | 
			
		||||
	return "defer"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *DeferRule) allowFromArgs(args lint.Arguments) map[string]bool {
 | 
			
		||||
	if len(args) < 1 {
 | 
			
		||||
		allow := map[string]bool{
 | 
			
		||||
			"loop":        true,
 | 
			
		||||
			"call-chain":  true,
 | 
			
		||||
			"method-call": true,
 | 
			
		||||
			"return":      true,
 | 
			
		||||
			"recover":     true,
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return allow
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	aa, ok := args[0].([]interface{})
 | 
			
		||||
	if !ok {
 | 
			
		||||
		panic(fmt.Sprintf("Invalid argument '%v' for 'defer' rule. Expecting []string, got %T", args[0], args[0]))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	allow := make(map[string]bool, len(aa))
 | 
			
		||||
	for _, subcase := range aa {
 | 
			
		||||
		sc, ok := subcase.(string)
 | 
			
		||||
		if !ok {
 | 
			
		||||
			panic(fmt.Sprintf("Invalid argument '%v' for 'defer' rule. Expecting string, got %T", subcase, subcase))
 | 
			
		||||
		}
 | 
			
		||||
		allow[sc] = true
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return allow
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type lintDeferRule struct {
 | 
			
		||||
	onFailure  func(lint.Failure)
 | 
			
		||||
	inALoop    bool
 | 
			
		||||
	inADefer   bool
 | 
			
		||||
	inAFuncLit bool
 | 
			
		||||
	allow      map[string]bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (w lintDeferRule) Visit(node ast.Node) ast.Visitor {
 | 
			
		||||
	switch n := node.(type) {
 | 
			
		||||
	case *ast.ForStmt:
 | 
			
		||||
		w.visitSubtree(n.Body, w.inADefer, true, w.inAFuncLit)
 | 
			
		||||
		return nil
 | 
			
		||||
	case *ast.RangeStmt:
 | 
			
		||||
		w.visitSubtree(n.Body, w.inADefer, true, w.inAFuncLit)
 | 
			
		||||
		return nil
 | 
			
		||||
	case *ast.FuncLit:
 | 
			
		||||
		w.visitSubtree(n.Body, w.inADefer, false, true)
 | 
			
		||||
		return nil
 | 
			
		||||
	case *ast.ReturnStmt:
 | 
			
		||||
		if len(n.Results) != 0 && w.inADefer && w.inAFuncLit {
 | 
			
		||||
			w.newFailure("return in a defer function has no effect", n, 1.0, "logic", "return")
 | 
			
		||||
		}
 | 
			
		||||
	case *ast.CallExpr:
 | 
			
		||||
		if isIdent(n.Fun, "recover") && !w.inADefer {
 | 
			
		||||
			// confidence is not 1 because recover can be in a function that is deferred elsewhere
 | 
			
		||||
			w.newFailure("recover must be called inside a deferred function", n, 0.8, "logic", "recover")
 | 
			
		||||
		}
 | 
			
		||||
	case *ast.DeferStmt:
 | 
			
		||||
		w.visitSubtree(n.Call.Fun, true, false, false)
 | 
			
		||||
 | 
			
		||||
		if w.inALoop {
 | 
			
		||||
			w.newFailure("prefer not to defer inside loops", n, 1.0, "bad practice", "loop")
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		switch fn := n.Call.Fun.(type) {
 | 
			
		||||
		case *ast.CallExpr:
 | 
			
		||||
			w.newFailure("prefer not to defer chains of function calls", fn, 1.0, "bad practice", "call-chain")
 | 
			
		||||
		case *ast.SelectorExpr:
 | 
			
		||||
			if id, ok := fn.X.(*ast.Ident); ok {
 | 
			
		||||
				isMethodCall := id != nil && id.Obj != nil && id.Obj.Kind == ast.Typ
 | 
			
		||||
				if isMethodCall {
 | 
			
		||||
					w.newFailure("be careful when deferring calls to methods without pointer receiver", fn, 0.8, "bad practice", "method-call")
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return w
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (w lintDeferRule) visitSubtree(n ast.Node, inADefer, inALoop, inAFuncLit bool) {
 | 
			
		||||
	nw := &lintDeferRule{
 | 
			
		||||
		onFailure:  w.onFailure,
 | 
			
		||||
		inADefer:   inADefer,
 | 
			
		||||
		inALoop:    inALoop,
 | 
			
		||||
		inAFuncLit: inAFuncLit,
 | 
			
		||||
		allow:      w.allow}
 | 
			
		||||
	ast.Walk(nw, n)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (w lintDeferRule) newFailure(msg string, node ast.Node, confidence float64, cat string, subcase string) {
 | 
			
		||||
	if !w.allow[subcase] {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	w.onFailure(lint.Failure{
 | 
			
		||||
		Confidence: confidence,
 | 
			
		||||
		Node:       node,
 | 
			
		||||
		Category:   cat,
 | 
			
		||||
		Failure:    msg,
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										78
									
								
								vendor/github.com/mgechev/revive/rule/early-return.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								vendor/github.com/mgechev/revive/rule/early-return.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,78 @@
 | 
			
		||||
package rule
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"go/ast"
 | 
			
		||||
 | 
			
		||||
	"github.com/mgechev/revive/lint"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// EarlyReturnRule lints given else constructs.
 | 
			
		||||
type EarlyReturnRule struct{}
 | 
			
		||||
 | 
			
		||||
// Apply applies the rule to given file.
 | 
			
		||||
func (r *EarlyReturnRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure {
 | 
			
		||||
	var failures []lint.Failure
 | 
			
		||||
 | 
			
		||||
	onFailure := func(failure lint.Failure) {
 | 
			
		||||
		failures = append(failures, failure)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	w := lintEarlyReturnRule{onFailure: onFailure}
 | 
			
		||||
	ast.Walk(w, file.AST)
 | 
			
		||||
	return failures
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Name returns the rule name.
 | 
			
		||||
func (r *EarlyReturnRule) Name() string {
 | 
			
		||||
	return "early-return"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type lintEarlyReturnRule struct {
 | 
			
		||||
	onFailure func(lint.Failure)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (w lintEarlyReturnRule) Visit(node ast.Node) ast.Visitor {
 | 
			
		||||
	switch n := node.(type) {
 | 
			
		||||
	case *ast.IfStmt:
 | 
			
		||||
		if n.Else == nil {
 | 
			
		||||
			// no else branch
 | 
			
		||||
			return w
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		elseBlock, ok := n.Else.(*ast.BlockStmt)
 | 
			
		||||
		if !ok {
 | 
			
		||||
			// is if-else-if
 | 
			
		||||
			return w
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		lenElseBlock := len(elseBlock.List)
 | 
			
		||||
		if lenElseBlock < 1 {
 | 
			
		||||
			// empty else block, continue (there is another rule that warns on empty blocks)
 | 
			
		||||
			return w
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		lenThenBlock := len(n.Body.List)
 | 
			
		||||
		if lenThenBlock < 1 {
 | 
			
		||||
			// then block is empty thus the stmt can be simplified
 | 
			
		||||
			w.onFailure(lint.Failure{
 | 
			
		||||
				Confidence: 1,
 | 
			
		||||
				Node:       n,
 | 
			
		||||
				Failure:    "if c { } else {... return} can be simplified to if !c { ... return }",
 | 
			
		||||
			})
 | 
			
		||||
 | 
			
		||||
			return w
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		_, lastThenStmtIsReturn := n.Body.List[lenThenBlock-1].(*ast.ReturnStmt)
 | 
			
		||||
		_, lastElseStmtIsReturn := elseBlock.List[lenElseBlock-1].(*ast.ReturnStmt)
 | 
			
		||||
		if lastElseStmtIsReturn && !lastThenStmtIsReturn {
 | 
			
		||||
			w.onFailure(lint.Failure{
 | 
			
		||||
				Confidence: 1,
 | 
			
		||||
				Node:       n,
 | 
			
		||||
				Failure:    "if c {...} else {... return } can be simplified to if !c { ... return } ...",
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return w
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										63
									
								
								vendor/github.com/mgechev/revive/rule/empty-block.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										63
									
								
								vendor/github.com/mgechev/revive/rule/empty-block.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -17,7 +17,7 @@ func (r *EmptyBlockRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure
 | 
			
		||||
		failures = append(failures, failure)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	w := lintEmptyBlock{make([]*ast.BlockStmt, 0), onFailure}
 | 
			
		||||
	w := lintEmptyBlock{make(map[*ast.BlockStmt]bool, 0), onFailure}
 | 
			
		||||
	ast.Walk(w, file.AST)
 | 
			
		||||
	return failures
 | 
			
		||||
}
 | 
			
		||||
@@ -28,49 +28,38 @@ func (r *EmptyBlockRule) Name() string {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type lintEmptyBlock struct {
 | 
			
		||||
	ignore    []*ast.BlockStmt
 | 
			
		||||
	ignore    map[*ast.BlockStmt]bool
 | 
			
		||||
	onFailure func(lint.Failure)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (w lintEmptyBlock) Visit(node ast.Node) ast.Visitor {
 | 
			
		||||
	fd, ok := node.(*ast.FuncDecl)
 | 
			
		||||
	if ok {
 | 
			
		||||
		w.ignore = append(w.ignore, fd.Body)
 | 
			
		||||
	switch n := node.(type) {
 | 
			
		||||
	case *ast.FuncDecl:
 | 
			
		||||
		w.ignore[n.Body] = true
 | 
			
		||||
		return w
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fl, ok := node.(*ast.FuncLit)
 | 
			
		||||
	if ok {
 | 
			
		||||
		w.ignore = append(w.ignore, fl.Body)
 | 
			
		||||
	case *ast.FuncLit:
 | 
			
		||||
		w.ignore[n.Body] = true
 | 
			
		||||
		return w
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	block, ok := node.(*ast.BlockStmt)
 | 
			
		||||
	if !ok {
 | 
			
		||||
		return w
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if mustIgnore(block, w.ignore) {
 | 
			
		||||
		return w
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if len(block.List) == 0 {
 | 
			
		||||
		w.onFailure(lint.Failure{
 | 
			
		||||
			Confidence: 1,
 | 
			
		||||
			Node:       block,
 | 
			
		||||
			Category:   "logic",
 | 
			
		||||
			Failure:    "this block is empty, you can remove it",
 | 
			
		||||
		})
 | 
			
		||||
	case *ast.RangeStmt:
 | 
			
		||||
		if len(n.Body.List) == 0 {
 | 
			
		||||
			w.onFailure(lint.Failure{
 | 
			
		||||
				Confidence: 0.9,
 | 
			
		||||
				Node:       n,
 | 
			
		||||
				Category:   "logic",
 | 
			
		||||
				Failure:    "this block is empty, you can remove it",
 | 
			
		||||
			})
 | 
			
		||||
			return nil // skip visiting the range subtree (it will produce a duplicated failure)
 | 
			
		||||
		}
 | 
			
		||||
	case *ast.BlockStmt:
 | 
			
		||||
		if !w.ignore[n] && len(n.List) == 0 {
 | 
			
		||||
			w.onFailure(lint.Failure{
 | 
			
		||||
				Confidence: 1,
 | 
			
		||||
				Node:       n,
 | 
			
		||||
				Category:   "logic",
 | 
			
		||||
				Failure:    "this block is empty, you can remove it",
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return w
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func mustIgnore(block *ast.BlockStmt, blackList []*ast.BlockStmt) bool {
 | 
			
		||||
	for _, b := range blackList {
 | 
			
		||||
		if b == block {
 | 
			
		||||
			return true
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return false
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										82
									
								
								vendor/github.com/mgechev/revive/rule/identical-branches.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								vendor/github.com/mgechev/revive/rule/identical-branches.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,82 @@
 | 
			
		||||
package rule
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"go/ast"
 | 
			
		||||
 | 
			
		||||
	"github.com/mgechev/revive/lint"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// IdenticalBranchesRule warns on constant logical expressions.
 | 
			
		||||
type IdenticalBranchesRule struct{}
 | 
			
		||||
 | 
			
		||||
// Apply applies the rule to given file.
 | 
			
		||||
func (r *IdenticalBranchesRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure {
 | 
			
		||||
	var failures []lint.Failure
 | 
			
		||||
 | 
			
		||||
	onFailure := func(failure lint.Failure) {
 | 
			
		||||
		failures = append(failures, failure)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	astFile := file.AST
 | 
			
		||||
	w := &lintIdenticalBranches{astFile, onFailure}
 | 
			
		||||
	ast.Walk(w, astFile)
 | 
			
		||||
	return failures
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Name returns the rule name.
 | 
			
		||||
func (r *IdenticalBranchesRule) Name() string {
 | 
			
		||||
	return "identical-branches"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type lintIdenticalBranches struct {
 | 
			
		||||
	file      *ast.File
 | 
			
		||||
	onFailure func(lint.Failure)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (w *lintIdenticalBranches) Visit(node ast.Node) ast.Visitor {
 | 
			
		||||
	n, ok := node.(*ast.IfStmt)
 | 
			
		||||
	if !ok {
 | 
			
		||||
		return w
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if n.Else == nil {
 | 
			
		||||
		return w
 | 
			
		||||
	}
 | 
			
		||||
	branches := []*ast.BlockStmt{n.Body}
 | 
			
		||||
 | 
			
		||||
	elseBranch, ok := n.Else.(*ast.BlockStmt)
 | 
			
		||||
	if !ok { // if-else-if construction
 | 
			
		||||
		return w
 | 
			
		||||
	}
 | 
			
		||||
	branches = append(branches, elseBranch)
 | 
			
		||||
 | 
			
		||||
	if w.identicalBranches(branches) {
 | 
			
		||||
		w.newFailure(n, "both branches of the if are identical")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return w
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (w *lintIdenticalBranches) identicalBranches(branches []*ast.BlockStmt) bool {
 | 
			
		||||
	if len(branches) < 2 {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ref := gofmt(branches[0])
 | 
			
		||||
	for i := 1; i < len(branches); i++ {
 | 
			
		||||
		if gofmt(branches[i]) != ref {
 | 
			
		||||
			return false
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (w lintIdenticalBranches) newFailure(node ast.Node, msg string) {
 | 
			
		||||
	w.onFailure(lint.Failure{
 | 
			
		||||
		Confidence: 1,
 | 
			
		||||
		Node:       node,
 | 
			
		||||
		Category:   "logic",
 | 
			
		||||
		Failure:    msg,
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										183
									
								
								vendor/github.com/mgechev/revive/rule/unconditional-recursion.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										183
									
								
								vendor/github.com/mgechev/revive/rule/unconditional-recursion.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,183 @@
 | 
			
		||||
package rule
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"go/ast"
 | 
			
		||||
 | 
			
		||||
	"github.com/mgechev/revive/lint"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// UnconditionalRecursionRule lints given else constructs.
 | 
			
		||||
type UnconditionalRecursionRule struct{}
 | 
			
		||||
 | 
			
		||||
// Apply applies the rule to given file.
 | 
			
		||||
func (r *UnconditionalRecursionRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure {
 | 
			
		||||
	var failures []lint.Failure
 | 
			
		||||
 | 
			
		||||
	onFailure := func(failure lint.Failure) {
 | 
			
		||||
		failures = append(failures, failure)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	w := lintUnconditionalRecursionRule{onFailure: onFailure}
 | 
			
		||||
	ast.Walk(w, file.AST)
 | 
			
		||||
	return failures
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Name returns the rule name.
 | 
			
		||||
func (r *UnconditionalRecursionRule) Name() string {
 | 
			
		||||
	return "unconditional-recursion"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type funcDesc struct {
 | 
			
		||||
	reciverID *ast.Ident
 | 
			
		||||
	id        *ast.Ident
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (fd *funcDesc) equal(other *funcDesc) bool {
 | 
			
		||||
	receiversAreEqual := (fd.reciverID == nil && other.reciverID == nil) || fd.reciverID != nil && other.reciverID != nil && fd.reciverID.Name == other.reciverID.Name
 | 
			
		||||
	idsAreEqual := (fd.id == nil && other.id == nil) || fd.id.Name == other.id.Name
 | 
			
		||||
 | 
			
		||||
	return receiversAreEqual && idsAreEqual
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type funcStatus struct {
 | 
			
		||||
	funcDesc            *funcDesc
 | 
			
		||||
	seenConditionalExit bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type lintUnconditionalRecursionRule struct {
 | 
			
		||||
	onFailure   func(lint.Failure)
 | 
			
		||||
	currentFunc *funcStatus
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Visit will traverse the file AST.
 | 
			
		||||
// The rule is based in the following algorithm: inside each function body we search for calls to the function itself.
 | 
			
		||||
// We do not search inside conditional control structures (if, for, switch, ...) because any recursive call inside them is conditioned
 | 
			
		||||
// We do search inside conditional control structures are statements that will take the control out of the function (return, exit, panic)
 | 
			
		||||
// If we find conditional control exits, it means the function is NOT unconditionally-recursive
 | 
			
		||||
// If we find a recursive call before finding any conditional exit, a failure is generated
 | 
			
		||||
// In resume: if we found a recursive call control-dependant from the entry point of the function then we raise a failure.
 | 
			
		||||
func (w lintUnconditionalRecursionRule) Visit(node ast.Node) ast.Visitor {
 | 
			
		||||
	switch n := node.(type) {
 | 
			
		||||
	case *ast.FuncDecl:
 | 
			
		||||
		var rec *ast.Ident
 | 
			
		||||
		switch {
 | 
			
		||||
		case n.Recv == nil || n.Recv.NumFields() < 1 || len(n.Recv.List[0].Names) < 1:
 | 
			
		||||
			rec = nil
 | 
			
		||||
		default:
 | 
			
		||||
			rec = n.Recv.List[0].Names[0]
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		w.currentFunc = &funcStatus{&funcDesc{rec, n.Name}, false}
 | 
			
		||||
	case *ast.CallExpr:
 | 
			
		||||
		var funcID *ast.Ident
 | 
			
		||||
		var selector *ast.Ident
 | 
			
		||||
		switch c := n.Fun.(type) {
 | 
			
		||||
		case *ast.Ident:
 | 
			
		||||
			selector = nil
 | 
			
		||||
			funcID = c
 | 
			
		||||
		case *ast.SelectorExpr:
 | 
			
		||||
			var ok bool
 | 
			
		||||
			selector, ok = c.X.(*ast.Ident)
 | 
			
		||||
			if !ok { // a.b....Foo()
 | 
			
		||||
				return nil
 | 
			
		||||
			}
 | 
			
		||||
			funcID = c.Sel
 | 
			
		||||
		default:
 | 
			
		||||
			return w
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if w.currentFunc != nil && // not in a func body
 | 
			
		||||
			!w.currentFunc.seenConditionalExit && // there is a conditional exit in the function
 | 
			
		||||
			w.currentFunc.funcDesc.equal(&funcDesc{selector, funcID}) {
 | 
			
		||||
			w.onFailure(lint.Failure{
 | 
			
		||||
				Category:   "logic",
 | 
			
		||||
				Confidence: 1,
 | 
			
		||||
				Node:       n,
 | 
			
		||||
				Failure:    "unconditional recursive call",
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
	case *ast.IfStmt:
 | 
			
		||||
		w.updateFuncStatus(n.Body)
 | 
			
		||||
		w.updateFuncStatus(n.Else)
 | 
			
		||||
		return nil
 | 
			
		||||
	case *ast.SelectStmt:
 | 
			
		||||
		w.updateFuncStatus(n.Body)
 | 
			
		||||
		return nil
 | 
			
		||||
	case *ast.RangeStmt:
 | 
			
		||||
		w.updateFuncStatus(n.Body)
 | 
			
		||||
		return nil
 | 
			
		||||
	case *ast.TypeSwitchStmt:
 | 
			
		||||
		w.updateFuncStatus(n.Body)
 | 
			
		||||
		return nil
 | 
			
		||||
	case *ast.SwitchStmt:
 | 
			
		||||
		w.updateFuncStatus(n.Body)
 | 
			
		||||
		return nil
 | 
			
		||||
	case *ast.GoStmt:
 | 
			
		||||
		for _, a := range n.Call.Args {
 | 
			
		||||
			ast.Walk(w, a) // check if arguments have a recursive call
 | 
			
		||||
		}
 | 
			
		||||
		return nil // recursive async call is not an issue
 | 
			
		||||
	case *ast.ForStmt:
 | 
			
		||||
		if n.Cond != nil {
 | 
			
		||||
			return nil
 | 
			
		||||
		}
 | 
			
		||||
		// unconditional loop
 | 
			
		||||
		return w
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return w
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (w *lintUnconditionalRecursionRule) updateFuncStatus(node ast.Node) {
 | 
			
		||||
	if node == nil || w.currentFunc == nil || w.currentFunc.seenConditionalExit {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	w.currentFunc.seenConditionalExit = w.hasControlExit(node)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var exitFunctions = map[string]map[string]bool{
 | 
			
		||||
	"os":      map[string]bool{"Exit": true},
 | 
			
		||||
	"syscall": map[string]bool{"Exit": true},
 | 
			
		||||
	"log": map[string]bool{
 | 
			
		||||
		"Fatal":   true,
 | 
			
		||||
		"Fatalf":  true,
 | 
			
		||||
		"Fatalln": true,
 | 
			
		||||
		"Panic":   true,
 | 
			
		||||
		"Panicf":  true,
 | 
			
		||||
		"Panicln": true,
 | 
			
		||||
	},
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (w *lintUnconditionalRecursionRule) hasControlExit(node ast.Node) bool {
 | 
			
		||||
	// isExit returns true if the given node makes control exit the function
 | 
			
		||||
	isExit := func(node ast.Node) bool {
 | 
			
		||||
		switch n := node.(type) {
 | 
			
		||||
		case *ast.ReturnStmt:
 | 
			
		||||
			return true
 | 
			
		||||
		case *ast.CallExpr:
 | 
			
		||||
			if isIdent(n.Fun, "panic") {
 | 
			
		||||
				return true
 | 
			
		||||
			}
 | 
			
		||||
			se, ok := n.Fun.(*ast.SelectorExpr)
 | 
			
		||||
			if !ok {
 | 
			
		||||
				return false
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			id, ok := se.X.(*ast.Ident)
 | 
			
		||||
			if !ok {
 | 
			
		||||
				return false
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			fn := se.Sel.Name
 | 
			
		||||
			pkg := id.Name
 | 
			
		||||
			if exitFunctions[pkg] != nil && exitFunctions[pkg][fn] { // it's a call to an exit function
 | 
			
		||||
				return true
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return len(pick(node, isExit, nil)) != 0
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										115
									
								
								vendor/github.com/mgechev/revive/rule/unexported-naming.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										115
									
								
								vendor/github.com/mgechev/revive/rule/unexported-naming.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,115 @@
 | 
			
		||||
package rule
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"go/ast"
 | 
			
		||||
	"go/token"
 | 
			
		||||
 | 
			
		||||
	"github.com/mgechev/revive/lint"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// UnexportedNamingRule lints wrongly named unexported symbols.
 | 
			
		||||
type UnexportedNamingRule struct{}
 | 
			
		||||
 | 
			
		||||
// Apply applies the rule to given file.
 | 
			
		||||
func (r *UnexportedNamingRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure {
 | 
			
		||||
	var failures []lint.Failure
 | 
			
		||||
	onFailure := func(failure lint.Failure) {
 | 
			
		||||
		failures = append(failures, failure)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ba := &unexportablenamingLinter{onFailure}
 | 
			
		||||
	ast.Walk(ba, file.AST)
 | 
			
		||||
 | 
			
		||||
	return failures
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Name returns the rule name.
 | 
			
		||||
func (r *UnexportedNamingRule) Name() string {
 | 
			
		||||
	return "unexported-naming"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type unexportablenamingLinter struct {
 | 
			
		||||
	onFailure func(lint.Failure)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (unl unexportablenamingLinter) Visit(node ast.Node) ast.Visitor {
 | 
			
		||||
	switch n := node.(type) {
 | 
			
		||||
	case *ast.FuncDecl:
 | 
			
		||||
		unl.lintFunction(n.Type, n.Body)
 | 
			
		||||
		return nil
 | 
			
		||||
	case *ast.FuncLit:
 | 
			
		||||
		unl.lintFunction(n.Type, n.Body)
 | 
			
		||||
 | 
			
		||||
		return nil
 | 
			
		||||
	case *ast.AssignStmt:
 | 
			
		||||
		if n.Tok != token.DEFINE {
 | 
			
		||||
			return nil
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ids := []*ast.Ident{}
 | 
			
		||||
		for _, e := range n.Lhs {
 | 
			
		||||
			id, ok := e.(*ast.Ident)
 | 
			
		||||
			if !ok {
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
			ids = append(ids, id)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		unl.lintIDs(ids)
 | 
			
		||||
 | 
			
		||||
	case *ast.DeclStmt:
 | 
			
		||||
		gd, ok := n.Decl.(*ast.GenDecl)
 | 
			
		||||
		if !ok {
 | 
			
		||||
			return nil
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if len(gd.Specs) < 1 {
 | 
			
		||||
			return nil
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		vs, ok := gd.Specs[0].(*ast.ValueSpec)
 | 
			
		||||
		if !ok {
 | 
			
		||||
			return nil
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		unl.lintIDs(vs.Names)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return unl
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (unl unexportablenamingLinter) lintFunction(ft *ast.FuncType, body *ast.BlockStmt) {
 | 
			
		||||
	unl.lintFields(ft.Params)
 | 
			
		||||
	unl.lintFields(ft.Results)
 | 
			
		||||
 | 
			
		||||
	if body != nil {
 | 
			
		||||
		ast.Walk(unl, body)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (unl unexportablenamingLinter) lintFields(fields *ast.FieldList) {
 | 
			
		||||
	if fields == nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ids := []*ast.Ident{}
 | 
			
		||||
	for _, field := range fields.List {
 | 
			
		||||
		ids = append(ids, field.Names...)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	unl.lintIDs(ids)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (unl unexportablenamingLinter) lintIDs(ids []*ast.Ident) {
 | 
			
		||||
	for _, id := range ids {
 | 
			
		||||
		if id.IsExported() {
 | 
			
		||||
			unl.onFailure(lint.Failure{
 | 
			
		||||
				Node:       id,
 | 
			
		||||
				Confidence: 1,
 | 
			
		||||
				Category:   "naming",
 | 
			
		||||
				Failure:    fmt.Sprintf("the symbol %s is local, its name should start with a lowercase letter", id.String()),
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/github.com/mgechev/revive/rule/unused-receiver.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/mgechev/revive/rule/unused-receiver.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -11,7 +11,7 @@ import (
 | 
			
		||||
type UnusedReceiverRule struct{}
 | 
			
		||||
 | 
			
		||||
// Apply applies the rule to given file.
 | 
			
		||||
func (_ *UnusedReceiverRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure {
 | 
			
		||||
func (*UnusedReceiverRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure {
 | 
			
		||||
	var failures []lint.Failure
 | 
			
		||||
 | 
			
		||||
	onFailure := func(failure lint.Failure) {
 | 
			
		||||
@@ -26,7 +26,7 @@ func (_ *UnusedReceiverRule) Apply(file *lint.File, _ lint.Arguments) []lint.Fai
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Name returns the rule name.
 | 
			
		||||
func (_ *UnusedReceiverRule) Name() string {
 | 
			
		||||
func (*UnusedReceiverRule) Name() string {
 | 
			
		||||
	return "unused-receiver"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/github.com/mgechev/revive/rule/utils.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/mgechev/revive/rule/utils.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -182,8 +182,8 @@ func isExprABooleanLit(n ast.Node) (lexeme string, ok bool) {
 | 
			
		||||
	return oper.Name, (oper.Name == trueName || oper.Name == falseName)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// gofmt returns a string representation of the expression.
 | 
			
		||||
func gofmt(x ast.Expr) string {
 | 
			
		||||
// gofmt returns a string representation of an AST subtree.
 | 
			
		||||
func gofmt(x interface{}) string {
 | 
			
		||||
	buf := bytes.Buffer{}
 | 
			
		||||
	fs := token.NewFileSet()
 | 
			
		||||
	printer.Fprint(&buf, fs, x)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										40
									
								
								vendor/github.com/pelletier/go-toml/azure-pipelines.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										40
									
								
								vendor/github.com/pelletier/go-toml/azure-pipelines.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -13,9 +13,9 @@ stages:
 | 
			
		||||
      vmImage: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
    - task: GoTool@0
 | 
			
		||||
      displayName: "Install Go 1.14"
 | 
			
		||||
      displayName: "Install Go 1.15"
 | 
			
		||||
      inputs:
 | 
			
		||||
        version: "1.14"
 | 
			
		||||
        version: "1.15"
 | 
			
		||||
    - script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/"
 | 
			
		||||
    - script: mkdir -p ${HOME}/go/src/github.com/pelletier/go-toml
 | 
			
		||||
    - script: cp -R . ${HOME}/go/src/github.com/pelletier/go-toml
 | 
			
		||||
@@ -36,9 +36,9 @@ stages:
 | 
			
		||||
      vmImage: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
    - task: GoTool@0
 | 
			
		||||
      displayName: "Install Go 1.14"
 | 
			
		||||
      displayName: "Install Go 1.15"
 | 
			
		||||
      inputs:
 | 
			
		||||
        version: "1.14"
 | 
			
		||||
        version: "1.15"
 | 
			
		||||
    - task: Go@0
 | 
			
		||||
      displayName: "go fmt ./..."
 | 
			
		||||
      inputs:
 | 
			
		||||
@@ -51,9 +51,9 @@ stages:
 | 
			
		||||
      vmImage: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
    - task: GoTool@0
 | 
			
		||||
      displayName: "Install Go 1.14"
 | 
			
		||||
      displayName: "Install Go 1.15"
 | 
			
		||||
      inputs:
 | 
			
		||||
        version: "1.14"
 | 
			
		||||
        version: "1.15"
 | 
			
		||||
    - task: Go@0
 | 
			
		||||
      displayName: "Generate coverage"
 | 
			
		||||
      inputs:
 | 
			
		||||
@@ -71,9 +71,9 @@ stages:
 | 
			
		||||
      vmImage: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
    - task: GoTool@0
 | 
			
		||||
      displayName: "Install Go 1.14"
 | 
			
		||||
      displayName: "Install Go 1.15"
 | 
			
		||||
      inputs:
 | 
			
		||||
        version: "1.14"
 | 
			
		||||
        version: "1.15"
 | 
			
		||||
    - script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/"
 | 
			
		||||
    - task: Bash@3
 | 
			
		||||
      inputs:
 | 
			
		||||
@@ -86,9 +86,9 @@ stages:
 | 
			
		||||
      vmImage: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
    - task: GoTool@0
 | 
			
		||||
      displayName: "Install Go 1.14"
 | 
			
		||||
      displayName: "Install Go 1.15"
 | 
			
		||||
      inputs:
 | 
			
		||||
        version: "1.14"
 | 
			
		||||
        version: "1.15"
 | 
			
		||||
    - script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/"
 | 
			
		||||
    - script: mkdir -p ${HOME}/go/src/github.com/pelletier/go-toml
 | 
			
		||||
    - script: cp -R . ${HOME}/go/src/github.com/pelletier/go-toml
 | 
			
		||||
@@ -102,6 +102,15 @@ stages:
 | 
			
		||||
    displayName: "unit tests"
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        linux 1.15:
 | 
			
		||||
          goVersion: '1.15'
 | 
			
		||||
          imageName: 'ubuntu-latest'
 | 
			
		||||
        mac 1.15:
 | 
			
		||||
          goVersion: '1.15'
 | 
			
		||||
          imageName: 'macOS-latest'
 | 
			
		||||
        windows 1.15:
 | 
			
		||||
          goVersion: '1.15'
 | 
			
		||||
          imageName: 'windows-latest'
 | 
			
		||||
        linux 1.14:
 | 
			
		||||
          goVersion: '1.14'
 | 
			
		||||
          imageName: 'ubuntu-latest'
 | 
			
		||||
@@ -111,15 +120,6 @@ stages:
 | 
			
		||||
        windows 1.14:
 | 
			
		||||
          goVersion: '1.14'
 | 
			
		||||
          imageName: 'windows-latest'
 | 
			
		||||
        linux 1.13:
 | 
			
		||||
          goVersion: '1.13'
 | 
			
		||||
          imageName: 'ubuntu-latest'
 | 
			
		||||
        mac 1.13:
 | 
			
		||||
          goVersion: '1.13'
 | 
			
		||||
          imageName: 'macOS-latest'
 | 
			
		||||
        windows 1.13:
 | 
			
		||||
          goVersion: '1.13'
 | 
			
		||||
          imageName: 'windows-latest'
 | 
			
		||||
    pool:
 | 
			
		||||
      vmImage: $(imageName)
 | 
			
		||||
    steps:
 | 
			
		||||
@@ -155,7 +155,7 @@ stages:
 | 
			
		||||
    - task: GoTool@0
 | 
			
		||||
      displayName: "Install Go"
 | 
			
		||||
      inputs:
 | 
			
		||||
        version: 1.14
 | 
			
		||||
        version: 1.15
 | 
			
		||||
    - task: Bash@3
 | 
			
		||||
      inputs:
 | 
			
		||||
        targetType: inline
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										164
									
								
								vendor/github.com/pelletier/go-toml/benchmark.json
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										164
									
								
								vendor/github.com/pelletier/go-toml/benchmark.json
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,164 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
    "array": {
 | 
			
		||||
        "key1": [
 | 
			
		||||
            1,
 | 
			
		||||
            2,
 | 
			
		||||
            3
 | 
			
		||||
        ],
 | 
			
		||||
        "key2": [
 | 
			
		||||
            "red",
 | 
			
		||||
            "yellow",
 | 
			
		||||
            "green"
 | 
			
		||||
        ],
 | 
			
		||||
        "key3": [
 | 
			
		||||
            [
 | 
			
		||||
                1,
 | 
			
		||||
                2
 | 
			
		||||
            ],
 | 
			
		||||
            [
 | 
			
		||||
                3,
 | 
			
		||||
                4,
 | 
			
		||||
                5
 | 
			
		||||
            ]
 | 
			
		||||
        ],
 | 
			
		||||
        "key4": [
 | 
			
		||||
            [
 | 
			
		||||
                1,
 | 
			
		||||
                2
 | 
			
		||||
            ],
 | 
			
		||||
            [
 | 
			
		||||
                "a",
 | 
			
		||||
                "b",
 | 
			
		||||
                "c"
 | 
			
		||||
            ]
 | 
			
		||||
        ],
 | 
			
		||||
        "key5": [
 | 
			
		||||
            1,
 | 
			
		||||
            2,
 | 
			
		||||
            3
 | 
			
		||||
        ],
 | 
			
		||||
        "key6": [
 | 
			
		||||
            1,
 | 
			
		||||
            2
 | 
			
		||||
        ]
 | 
			
		||||
    },
 | 
			
		||||
    "boolean": {
 | 
			
		||||
        "False": false,
 | 
			
		||||
        "True": true
 | 
			
		||||
    },
 | 
			
		||||
    "datetime": {
 | 
			
		||||
        "key1": "1979-05-27T07:32:00Z",
 | 
			
		||||
        "key2": "1979-05-27T00:32:00-07:00",
 | 
			
		||||
        "key3": "1979-05-27T00:32:00.999999-07:00"
 | 
			
		||||
    },
 | 
			
		||||
    "float": {
 | 
			
		||||
        "both": {
 | 
			
		||||
            "key": 6.626e-34
 | 
			
		||||
        },
 | 
			
		||||
        "exponent": {
 | 
			
		||||
            "key1": 5e+22,
 | 
			
		||||
            "key2": 1000000,
 | 
			
		||||
            "key3": -0.02
 | 
			
		||||
        },
 | 
			
		||||
        "fractional": {
 | 
			
		||||
            "key1": 1,
 | 
			
		||||
            "key2": 3.1415,
 | 
			
		||||
            "key3": -0.01
 | 
			
		||||
        },
 | 
			
		||||
        "underscores": {
 | 
			
		||||
            "key1": 9224617.445991227,
 | 
			
		||||
            "key2": 1e+100
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    "fruit": [{
 | 
			
		||||
            "name": "apple",
 | 
			
		||||
            "physical": {
 | 
			
		||||
                "color": "red",
 | 
			
		||||
                "shape": "round"
 | 
			
		||||
            },
 | 
			
		||||
            "variety": [{
 | 
			
		||||
                    "name": "red delicious"
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "name": "granny smith"
 | 
			
		||||
                }
 | 
			
		||||
            ]
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "banana",
 | 
			
		||||
            "variety": [{
 | 
			
		||||
                "name": "plantain"
 | 
			
		||||
            }]
 | 
			
		||||
        }
 | 
			
		||||
    ],
 | 
			
		||||
    "integer": {
 | 
			
		||||
        "key1": 99,
 | 
			
		||||
        "key2": 42,
 | 
			
		||||
        "key3": 0,
 | 
			
		||||
        "key4": -17,
 | 
			
		||||
        "underscores": {
 | 
			
		||||
            "key1": 1000,
 | 
			
		||||
            "key2": 5349221,
 | 
			
		||||
            "key3": 12345
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    "products": [{
 | 
			
		||||
            "name": "Hammer",
 | 
			
		||||
            "sku": 738594937
 | 
			
		||||
        },
 | 
			
		||||
        {},
 | 
			
		||||
        {
 | 
			
		||||
            "color": "gray",
 | 
			
		||||
            "name": "Nail",
 | 
			
		||||
            "sku": 284758393
 | 
			
		||||
        }
 | 
			
		||||
    ],
 | 
			
		||||
    "string": {
 | 
			
		||||
        "basic": {
 | 
			
		||||
            "basic": "I'm a string. \"You can quote me\". Name\tJosé\nLocation\tSF."
 | 
			
		||||
        },
 | 
			
		||||
        "literal": {
 | 
			
		||||
            "multiline": {
 | 
			
		||||
                "lines": "The first newline is\ntrimmed in raw strings.\n   All other whitespace\n   is preserved.\n",
 | 
			
		||||
                "regex2": "I [dw]on't need \\d{2} apples"
 | 
			
		||||
            },
 | 
			
		||||
            "quoted": "Tom \"Dubs\" Preston-Werner",
 | 
			
		||||
            "regex": "\u003c\\i\\c*\\s*\u003e",
 | 
			
		||||
            "winpath": "C:\\Users\\nodejs\\templates",
 | 
			
		||||
            "winpath2": "\\\\ServerX\\admin$\\system32\\"
 | 
			
		||||
        },
 | 
			
		||||
        "multiline": {
 | 
			
		||||
            "continued": {
 | 
			
		||||
                "key1": "The quick brown fox jumps over the lazy dog.",
 | 
			
		||||
                "key2": "The quick brown fox jumps over the lazy dog.",
 | 
			
		||||
                "key3": "The quick brown fox jumps over the lazy dog."
 | 
			
		||||
            },
 | 
			
		||||
            "key1": "One\nTwo",
 | 
			
		||||
            "key2": "One\nTwo",
 | 
			
		||||
            "key3": "One\nTwo"
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    "table": {
 | 
			
		||||
        "inline": {
 | 
			
		||||
            "name": {
 | 
			
		||||
                "first": "Tom",
 | 
			
		||||
                "last": "Preston-Werner"
 | 
			
		||||
            },
 | 
			
		||||
            "point": {
 | 
			
		||||
                "x": 1,
 | 
			
		||||
                "y": 2
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        "key": "value",
 | 
			
		||||
        "subtable": {
 | 
			
		||||
            "key": "another value"
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    "x": {
 | 
			
		||||
        "y": {
 | 
			
		||||
            "z": {
 | 
			
		||||
                "w": {}
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/github.com/pelletier/go-toml/benchmark.sh
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/pelletier/go-toml/benchmark.sh
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -20,11 +20,15 @@ git clone ${reference_git} ${ref_tempdir} >/dev/null 2>/dev/null
 | 
			
		||||
pushd ${ref_tempdir} >/dev/null
 | 
			
		||||
git checkout ${reference_ref} >/dev/null 2>/dev/null
 | 
			
		||||
go test -bench=. -benchmem | tee ${ref_benchmark}
 | 
			
		||||
cd benchmark
 | 
			
		||||
go test -bench=. -benchmem | tee -a ${ref_benchmark}
 | 
			
		||||
popd >/dev/null
 | 
			
		||||
 | 
			
		||||
echo ""
 | 
			
		||||
echo "=== local"
 | 
			
		||||
go test -bench=. -benchmem  | tee ${local_benchmark}
 | 
			
		||||
cd benchmark
 | 
			
		||||
go test -bench=. -benchmem | tee -a ${local_benchmark}
 | 
			
		||||
 | 
			
		||||
echo ""
 | 
			
		||||
echo "=== diff"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										244
									
								
								vendor/github.com/pelletier/go-toml/benchmark.toml
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										244
									
								
								vendor/github.com/pelletier/go-toml/benchmark.toml
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,244 +0,0 @@
 | 
			
		||||
################################################################################
 | 
			
		||||
## Comment
 | 
			
		||||
 | 
			
		||||
# Speak your mind with the hash symbol. They go from the symbol to the end of
 | 
			
		||||
# the line.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
## Table
 | 
			
		||||
 | 
			
		||||
# Tables (also known as hash tables or dictionaries) are collections of
 | 
			
		||||
# key/value pairs. They appear in square brackets on a line by themselves.
 | 
			
		||||
 | 
			
		||||
[table]
 | 
			
		||||
 | 
			
		||||
key = "value" # Yeah, you can do this.
 | 
			
		||||
 | 
			
		||||
# Nested tables are denoted by table names with dots in them. Name your tables
 | 
			
		||||
# whatever crap you please, just don't use #, ., [ or ].
 | 
			
		||||
 | 
			
		||||
[table.subtable]
 | 
			
		||||
 | 
			
		||||
key = "another value"
 | 
			
		||||
 | 
			
		||||
# You don't need to specify all the super-tables if you don't want to. TOML
 | 
			
		||||
# knows how to do it for you.
 | 
			
		||||
 | 
			
		||||
# [x] you
 | 
			
		||||
# [x.y] don't
 | 
			
		||||
# [x.y.z] need these
 | 
			
		||||
[x.y.z.w] # for this to work
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
## Inline Table
 | 
			
		||||
 | 
			
		||||
# Inline tables provide a more compact syntax for expressing tables. They are
 | 
			
		||||
# especially useful for grouped data that can otherwise quickly become verbose.
 | 
			
		||||
# Inline tables are enclosed in curly braces `{` and `}`. No newlines are
 | 
			
		||||
# allowed between the curly braces unless they are valid within a value.
 | 
			
		||||
 | 
			
		||||
[table.inline]
 | 
			
		||||
 | 
			
		||||
name = { first = "Tom", last = "Preston-Werner" }
 | 
			
		||||
point = { x = 1, y = 2 }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
## String
 | 
			
		||||
 | 
			
		||||
# There are four ways to express strings: basic, multi-line basic, literal, and
 | 
			
		||||
# multi-line literal. All strings must contain only valid UTF-8 characters.
 | 
			
		||||
 | 
			
		||||
[string.basic]
 | 
			
		||||
 | 
			
		||||
basic = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."
 | 
			
		||||
 | 
			
		||||
[string.multiline]
 | 
			
		||||
 | 
			
		||||
# The following strings are byte-for-byte equivalent:
 | 
			
		||||
key1 = "One\nTwo"
 | 
			
		||||
key2 = """One\nTwo"""
 | 
			
		||||
key3 = """
 | 
			
		||||
One
 | 
			
		||||
Two"""
 | 
			
		||||
 | 
			
		||||
[string.multiline.continued]
 | 
			
		||||
 | 
			
		||||
# The following strings are byte-for-byte equivalent:
 | 
			
		||||
key1 = "The quick brown fox jumps over the lazy dog."
 | 
			
		||||
 | 
			
		||||
key2 = """
 | 
			
		||||
The quick brown \
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  fox jumps over \
 | 
			
		||||
    the lazy dog."""
 | 
			
		||||
 | 
			
		||||
key3 = """\
 | 
			
		||||
       The quick brown \
 | 
			
		||||
       fox jumps over \
 | 
			
		||||
       the lazy dog.\
 | 
			
		||||
       """
 | 
			
		||||
 | 
			
		||||
[string.literal]
 | 
			
		||||
 | 
			
		||||
# What you see is what you get.
 | 
			
		||||
winpath  = 'C:\Users\nodejs\templates'
 | 
			
		||||
winpath2 = '\\ServerX\admin$\system32\'
 | 
			
		||||
quoted   = 'Tom "Dubs" Preston-Werner'
 | 
			
		||||
regex    = '<\i\c*\s*>'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
[string.literal.multiline]
 | 
			
		||||
 | 
			
		||||
regex2 = '''I [dw]on't need \d{2} apples'''
 | 
			
		||||
lines  = '''
 | 
			
		||||
The first newline is
 | 
			
		||||
trimmed in raw strings.
 | 
			
		||||
   All other whitespace
 | 
			
		||||
   is preserved.
 | 
			
		||||
'''
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
## Integer
 | 
			
		||||
 | 
			
		||||
# Integers are whole numbers. Positive numbers may be prefixed with a plus sign.
 | 
			
		||||
# Negative numbers are prefixed with a minus sign.
 | 
			
		||||
 | 
			
		||||
[integer]
 | 
			
		||||
 | 
			
		||||
key1 = +99
 | 
			
		||||
key2 = 42
 | 
			
		||||
key3 = 0
 | 
			
		||||
key4 = -17
 | 
			
		||||
 | 
			
		||||
[integer.underscores]
 | 
			
		||||
 | 
			
		||||
# For large numbers, you may use underscores to enhance readability. Each
 | 
			
		||||
# underscore must be surrounded by at least one digit.
 | 
			
		||||
key1 = 1_000
 | 
			
		||||
key2 = 5_349_221
 | 
			
		||||
key3 = 1_2_3_4_5     # valid but inadvisable
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
## Float
 | 
			
		||||
 | 
			
		||||
# A float consists of an integer part (which may be prefixed with a plus or
 | 
			
		||||
# minus sign) followed by a fractional part and/or an exponent part.
 | 
			
		||||
 | 
			
		||||
[float.fractional]
 | 
			
		||||
 | 
			
		||||
key1 = +1.0
 | 
			
		||||
key2 = 3.1415
 | 
			
		||||
key3 = -0.01
 | 
			
		||||
 | 
			
		||||
[float.exponent]
 | 
			
		||||
 | 
			
		||||
key1 = 5e+22
 | 
			
		||||
key2 = 1e6
 | 
			
		||||
key3 = -2E-2
 | 
			
		||||
 | 
			
		||||
[float.both]
 | 
			
		||||
 | 
			
		||||
key = 6.626e-34
 | 
			
		||||
 | 
			
		||||
[float.underscores]
 | 
			
		||||
 | 
			
		||||
key1 = 9_224_617.445_991_228_313
 | 
			
		||||
key2 = 1e1_00
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
## Boolean
 | 
			
		||||
 | 
			
		||||
# Booleans are just the tokens you're used to. Always lowercase.
 | 
			
		||||
 | 
			
		||||
[boolean]
 | 
			
		||||
 | 
			
		||||
True = true
 | 
			
		||||
False = false
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
## Datetime
 | 
			
		||||
 | 
			
		||||
# Datetimes are RFC 3339 dates.
 | 
			
		||||
 | 
			
		||||
[datetime]
 | 
			
		||||
 | 
			
		||||
key1 = 1979-05-27T07:32:00Z
 | 
			
		||||
key2 = 1979-05-27T00:32:00-07:00
 | 
			
		||||
key3 = 1979-05-27T00:32:00.999999-07:00
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
## Array
 | 
			
		||||
 | 
			
		||||
# Arrays are square brackets with other primitives inside. Whitespace is
 | 
			
		||||
# ignored. Elements are separated by commas. Data types may not be mixed.
 | 
			
		||||
 | 
			
		||||
[array]
 | 
			
		||||
 | 
			
		||||
key1 = [ 1, 2, 3 ]
 | 
			
		||||
key2 = [ "red", "yellow", "green" ]
 | 
			
		||||
key3 = [ [ 1, 2 ], [3, 4, 5] ]
 | 
			
		||||
#key4 = [ [ 1, 2 ], ["a", "b", "c"] ] # this is ok
 | 
			
		||||
 | 
			
		||||
# Arrays can also be multiline. So in addition to ignoring whitespace, arrays
 | 
			
		||||
# also ignore newlines between the brackets.  Terminating commas are ok before
 | 
			
		||||
# the closing bracket.
 | 
			
		||||
 | 
			
		||||
key5 = [
 | 
			
		||||
  1, 2, 3
 | 
			
		||||
]
 | 
			
		||||
key6 = [
 | 
			
		||||
  1,
 | 
			
		||||
  2, # this is ok
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
## Array of Tables
 | 
			
		||||
 | 
			
		||||
# These can be expressed by using a table name in double brackets. Each table
 | 
			
		||||
# with the same double bracketed name will be an element in the array. The
 | 
			
		||||
# tables are inserted in the order encountered.
 | 
			
		||||
 | 
			
		||||
[[products]]
 | 
			
		||||
 | 
			
		||||
name = "Hammer"
 | 
			
		||||
sku = 738594937
 | 
			
		||||
 | 
			
		||||
[[products]]
 | 
			
		||||
 | 
			
		||||
[[products]]
 | 
			
		||||
 | 
			
		||||
name = "Nail"
 | 
			
		||||
sku = 284758393
 | 
			
		||||
color = "gray"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# You can create nested arrays of tables as well.
 | 
			
		||||
 | 
			
		||||
[[fruit]]
 | 
			
		||||
  name = "apple"
 | 
			
		||||
 | 
			
		||||
  [fruit.physical]
 | 
			
		||||
    color = "red"
 | 
			
		||||
    shape = "round"
 | 
			
		||||
 | 
			
		||||
  [[fruit.variety]]
 | 
			
		||||
    name = "red delicious"
 | 
			
		||||
 | 
			
		||||
  [[fruit.variety]]
 | 
			
		||||
    name = "granny smith"
 | 
			
		||||
 | 
			
		||||
[[fruit]]
 | 
			
		||||
  name = "banana"
 | 
			
		||||
 | 
			
		||||
  [[fruit.variety]]
 | 
			
		||||
    name = "plantain"
 | 
			
		||||
							
								
								
									
										121
									
								
								vendor/github.com/pelletier/go-toml/benchmark.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										121
									
								
								vendor/github.com/pelletier/go-toml/benchmark.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,121 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
array:
 | 
			
		||||
  key1:
 | 
			
		||||
  - 1
 | 
			
		||||
  - 2
 | 
			
		||||
  - 3
 | 
			
		||||
  key2:
 | 
			
		||||
  - red
 | 
			
		||||
  - yellow
 | 
			
		||||
  - green
 | 
			
		||||
  key3:
 | 
			
		||||
  - - 1
 | 
			
		||||
    - 2
 | 
			
		||||
  - - 3
 | 
			
		||||
    - 4
 | 
			
		||||
    - 5
 | 
			
		||||
  key4:
 | 
			
		||||
  - - 1
 | 
			
		||||
    - 2
 | 
			
		||||
  - - a
 | 
			
		||||
    - b
 | 
			
		||||
    - c
 | 
			
		||||
  key5:
 | 
			
		||||
  - 1
 | 
			
		||||
  - 2
 | 
			
		||||
  - 3
 | 
			
		||||
  key6:
 | 
			
		||||
  - 1
 | 
			
		||||
  - 2
 | 
			
		||||
boolean:
 | 
			
		||||
  'False': false
 | 
			
		||||
  'True': true
 | 
			
		||||
datetime:
 | 
			
		||||
  key1: '1979-05-27T07:32:00Z'
 | 
			
		||||
  key2: '1979-05-27T00:32:00-07:00'
 | 
			
		||||
  key3: '1979-05-27T00:32:00.999999-07:00'
 | 
			
		||||
float:
 | 
			
		||||
  both:
 | 
			
		||||
    key: 6.626e-34
 | 
			
		||||
  exponent:
 | 
			
		||||
    key1: 5.0e+22
 | 
			
		||||
    key2: 1000000
 | 
			
		||||
    key3: -0.02
 | 
			
		||||
  fractional:
 | 
			
		||||
    key1: 1
 | 
			
		||||
    key2: 3.1415
 | 
			
		||||
    key3: -0.01
 | 
			
		||||
  underscores:
 | 
			
		||||
    key1: 9224617.445991227
 | 
			
		||||
    key2: 1.0e+100
 | 
			
		||||
fruit:
 | 
			
		||||
- name: apple
 | 
			
		||||
  physical:
 | 
			
		||||
    color: red
 | 
			
		||||
    shape: round
 | 
			
		||||
  variety:
 | 
			
		||||
  - name: red delicious
 | 
			
		||||
  - name: granny smith
 | 
			
		||||
- name: banana
 | 
			
		||||
  variety:
 | 
			
		||||
  - name: plantain
 | 
			
		||||
integer:
 | 
			
		||||
  key1: 99
 | 
			
		||||
  key2: 42
 | 
			
		||||
  key3: 0
 | 
			
		||||
  key4: -17
 | 
			
		||||
  underscores:
 | 
			
		||||
    key1: 1000
 | 
			
		||||
    key2: 5349221
 | 
			
		||||
    key3: 12345
 | 
			
		||||
products:
 | 
			
		||||
- name: Hammer
 | 
			
		||||
  sku: 738594937
 | 
			
		||||
- {}
 | 
			
		||||
- color: gray
 | 
			
		||||
  name: Nail
 | 
			
		||||
  sku: 284758393
 | 
			
		||||
string:
 | 
			
		||||
  basic:
 | 
			
		||||
    basic: "I'm a string. \"You can quote me\". Name\tJosé\nLocation\tSF."
 | 
			
		||||
  literal:
 | 
			
		||||
    multiline:
 | 
			
		||||
      lines: |
 | 
			
		||||
        The first newline is
 | 
			
		||||
        trimmed in raw strings.
 | 
			
		||||
           All other whitespace
 | 
			
		||||
           is preserved.
 | 
			
		||||
      regex2: I [dw]on't need \d{2} apples
 | 
			
		||||
    quoted: Tom "Dubs" Preston-Werner
 | 
			
		||||
    regex: "<\\i\\c*\\s*>"
 | 
			
		||||
    winpath: C:\Users\nodejs\templates
 | 
			
		||||
    winpath2: "\\\\ServerX\\admin$\\system32\\"
 | 
			
		||||
  multiline:
 | 
			
		||||
    continued:
 | 
			
		||||
      key1: The quick brown fox jumps over the lazy dog.
 | 
			
		||||
      key2: The quick brown fox jumps over the lazy dog.
 | 
			
		||||
      key3: The quick brown fox jumps over the lazy dog.
 | 
			
		||||
    key1: |-
 | 
			
		||||
      One
 | 
			
		||||
      Two
 | 
			
		||||
    key2: |-
 | 
			
		||||
      One
 | 
			
		||||
      Two
 | 
			
		||||
    key3: |-
 | 
			
		||||
      One
 | 
			
		||||
      Two
 | 
			
		||||
table:
 | 
			
		||||
  inline:
 | 
			
		||||
    name:
 | 
			
		||||
      first: Tom
 | 
			
		||||
      last: Preston-Werner
 | 
			
		||||
    point:
 | 
			
		||||
      x: 1
 | 
			
		||||
      y: 2
 | 
			
		||||
  key: value
 | 
			
		||||
  subtable:
 | 
			
		||||
    key: another value
 | 
			
		||||
x:
 | 
			
		||||
  y:
 | 
			
		||||
    z:
 | 
			
		||||
      w: {}
 | 
			
		||||
							
								
								
									
										6
									
								
								vendor/github.com/pelletier/go-toml/go.mod
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								vendor/github.com/pelletier/go-toml/go.mod
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -2,8 +2,4 @@ module github.com/pelletier/go-toml
 | 
			
		||||
 | 
			
		||||
go 1.12
 | 
			
		||||
 | 
			
		||||
require (
 | 
			
		||||
	github.com/BurntSushi/toml v0.3.1
 | 
			
		||||
	github.com/davecgh/go-spew v1.1.1
 | 
			
		||||
	gopkg.in/yaml.v2 v2.3.0
 | 
			
		||||
)
 | 
			
		||||
require github.com/davecgh/go-spew v1.1.1
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										100
									
								
								vendor/github.com/pelletier/go-toml/lexer.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										100
									
								
								vendor/github.com/pelletier/go-toml/lexer.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -306,7 +306,7 @@ func (l *tomlLexer) lexComma() tomlLexStateFn {
 | 
			
		||||
// Parse the key and emits its value without escape sequences.
 | 
			
		||||
// bare keys, basic string keys and literal string keys are supported.
 | 
			
		||||
func (l *tomlLexer) lexKey() tomlLexStateFn {
 | 
			
		||||
	growingString := ""
 | 
			
		||||
	var sb strings.Builder
 | 
			
		||||
 | 
			
		||||
	for r := l.peek(); isKeyChar(r) || r == '\n' || r == '\r'; r = l.peek() {
 | 
			
		||||
		if r == '"' {
 | 
			
		||||
@@ -315,7 +315,9 @@ func (l *tomlLexer) lexKey() tomlLexStateFn {
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return l.errorf(err.Error())
 | 
			
		||||
			}
 | 
			
		||||
			growingString += "\"" + str + "\""
 | 
			
		||||
			sb.WriteString("\"")
 | 
			
		||||
			sb.WriteString(str)
 | 
			
		||||
			sb.WriteString("\"")
 | 
			
		||||
			l.next()
 | 
			
		||||
			continue
 | 
			
		||||
		} else if r == '\'' {
 | 
			
		||||
@@ -324,41 +326,45 @@ func (l *tomlLexer) lexKey() tomlLexStateFn {
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return l.errorf(err.Error())
 | 
			
		||||
			}
 | 
			
		||||
			growingString += "'" + str + "'"
 | 
			
		||||
			sb.WriteString("'")
 | 
			
		||||
			sb.WriteString(str)
 | 
			
		||||
			sb.WriteString("'")
 | 
			
		||||
			l.next()
 | 
			
		||||
			continue
 | 
			
		||||
		} else if r == '\n' {
 | 
			
		||||
			return l.errorf("keys cannot contain new lines")
 | 
			
		||||
		} else if isSpace(r) {
 | 
			
		||||
			str := " "
 | 
			
		||||
			var str strings.Builder
 | 
			
		||||
			str.WriteString(" ")
 | 
			
		||||
 | 
			
		||||
			// skip trailing whitespace
 | 
			
		||||
			l.next()
 | 
			
		||||
			for r = l.peek(); isSpace(r); r = l.peek() {
 | 
			
		||||
				str += string(r)
 | 
			
		||||
				str.WriteRune(r)
 | 
			
		||||
				l.next()
 | 
			
		||||
			}
 | 
			
		||||
			// break loop if not a dot
 | 
			
		||||
			if r != '.' {
 | 
			
		||||
				break
 | 
			
		||||
			}
 | 
			
		||||
			str += "."
 | 
			
		||||
			str.WriteString(".")
 | 
			
		||||
			// skip trailing whitespace after dot
 | 
			
		||||
			l.next()
 | 
			
		||||
			for r = l.peek(); isSpace(r); r = l.peek() {
 | 
			
		||||
				str += string(r)
 | 
			
		||||
				str.WriteRune(r)
 | 
			
		||||
				l.next()
 | 
			
		||||
			}
 | 
			
		||||
			growingString += str
 | 
			
		||||
			sb.WriteString(str.String())
 | 
			
		||||
			continue
 | 
			
		||||
		} else if r == '.' {
 | 
			
		||||
			// skip
 | 
			
		||||
		} else if !isValidBareChar(r) {
 | 
			
		||||
			return l.errorf("keys cannot contain %c character", r)
 | 
			
		||||
		}
 | 
			
		||||
		growingString += string(r)
 | 
			
		||||
		sb.WriteRune(r)
 | 
			
		||||
		l.next()
 | 
			
		||||
	}
 | 
			
		||||
	l.emitWithValue(tokenKey, growingString)
 | 
			
		||||
	l.emitWithValue(tokenKey, sb.String())
 | 
			
		||||
	return l.lexVoid
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -383,7 +389,7 @@ func (l *tomlLexer) lexLeftBracket() tomlLexStateFn {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (l *tomlLexer) lexLiteralStringAsString(terminator string, discardLeadingNewLine bool) (string, error) {
 | 
			
		||||
	growingString := ""
 | 
			
		||||
	var sb strings.Builder
 | 
			
		||||
 | 
			
		||||
	if discardLeadingNewLine {
 | 
			
		||||
		if l.follow("\r\n") {
 | 
			
		||||
@@ -397,14 +403,14 @@ func (l *tomlLexer) lexLiteralStringAsString(terminator string, discardLeadingNe
 | 
			
		||||
	// find end of string
 | 
			
		||||
	for {
 | 
			
		||||
		if l.follow(terminator) {
 | 
			
		||||
			return growingString, nil
 | 
			
		||||
			return sb.String(), nil
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		next := l.peek()
 | 
			
		||||
		if next == eof {
 | 
			
		||||
			break
 | 
			
		||||
		}
 | 
			
		||||
		growingString += string(l.next())
 | 
			
		||||
		sb.WriteRune(l.next())
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return "", errors.New("unclosed string")
 | 
			
		||||
@@ -438,7 +444,7 @@ func (l *tomlLexer) lexLiteralString() tomlLexStateFn {
 | 
			
		||||
// Terminator is the substring indicating the end of the token.
 | 
			
		||||
// The resulting string does not include the terminator.
 | 
			
		||||
func (l *tomlLexer) lexStringAsString(terminator string, discardLeadingNewLine, acceptNewLines bool) (string, error) {
 | 
			
		||||
	growingString := ""
 | 
			
		||||
	var sb strings.Builder
 | 
			
		||||
 | 
			
		||||
	if discardLeadingNewLine {
 | 
			
		||||
		if l.follow("\r\n") {
 | 
			
		||||
@@ -451,7 +457,7 @@ func (l *tomlLexer) lexStringAsString(terminator string, discardLeadingNewLine,
 | 
			
		||||
 | 
			
		||||
	for {
 | 
			
		||||
		if l.follow(terminator) {
 | 
			
		||||
			return growingString, nil
 | 
			
		||||
			return sb.String(), nil
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if l.follow("\\") {
 | 
			
		||||
@@ -469,61 +475,61 @@ func (l *tomlLexer) lexStringAsString(terminator string, discardLeadingNewLine,
 | 
			
		||||
					l.next()
 | 
			
		||||
				}
 | 
			
		||||
			case '"':
 | 
			
		||||
				growingString += "\""
 | 
			
		||||
				sb.WriteString("\"")
 | 
			
		||||
				l.next()
 | 
			
		||||
			case 'n':
 | 
			
		||||
				growingString += "\n"
 | 
			
		||||
				sb.WriteString("\n")
 | 
			
		||||
				l.next()
 | 
			
		||||
			case 'b':
 | 
			
		||||
				growingString += "\b"
 | 
			
		||||
				sb.WriteString("\b")
 | 
			
		||||
				l.next()
 | 
			
		||||
			case 'f':
 | 
			
		||||
				growingString += "\f"
 | 
			
		||||
				sb.WriteString("\f")
 | 
			
		||||
				l.next()
 | 
			
		||||
			case '/':
 | 
			
		||||
				growingString += "/"
 | 
			
		||||
				sb.WriteString("/")
 | 
			
		||||
				l.next()
 | 
			
		||||
			case 't':
 | 
			
		||||
				growingString += "\t"
 | 
			
		||||
				sb.WriteString("\t")
 | 
			
		||||
				l.next()
 | 
			
		||||
			case 'r':
 | 
			
		||||
				growingString += "\r"
 | 
			
		||||
				sb.WriteString("\r")
 | 
			
		||||
				l.next()
 | 
			
		||||
			case '\\':
 | 
			
		||||
				growingString += "\\"
 | 
			
		||||
				sb.WriteString("\\")
 | 
			
		||||
				l.next()
 | 
			
		||||
			case 'u':
 | 
			
		||||
				l.next()
 | 
			
		||||
				code := ""
 | 
			
		||||
				var code strings.Builder
 | 
			
		||||
				for i := 0; i < 4; i++ {
 | 
			
		||||
					c := l.peek()
 | 
			
		||||
					if !isHexDigit(c) {
 | 
			
		||||
						return "", errors.New("unfinished unicode escape")
 | 
			
		||||
					}
 | 
			
		||||
					l.next()
 | 
			
		||||
					code = code + string(c)
 | 
			
		||||
					code.WriteRune(c)
 | 
			
		||||
				}
 | 
			
		||||
				intcode, err := strconv.ParseInt(code, 16, 32)
 | 
			
		||||
				intcode, err := strconv.ParseInt(code.String(), 16, 32)
 | 
			
		||||
				if err != nil {
 | 
			
		||||
					return "", errors.New("invalid unicode escape: \\u" + code)
 | 
			
		||||
					return "", errors.New("invalid unicode escape: \\u" + code.String())
 | 
			
		||||
				}
 | 
			
		||||
				growingString += string(rune(intcode))
 | 
			
		||||
				sb.WriteRune(rune(intcode))
 | 
			
		||||
			case 'U':
 | 
			
		||||
				l.next()
 | 
			
		||||
				code := ""
 | 
			
		||||
				var code strings.Builder
 | 
			
		||||
				for i := 0; i < 8; i++ {
 | 
			
		||||
					c := l.peek()
 | 
			
		||||
					if !isHexDigit(c) {
 | 
			
		||||
						return "", errors.New("unfinished unicode escape")
 | 
			
		||||
					}
 | 
			
		||||
					l.next()
 | 
			
		||||
					code = code + string(c)
 | 
			
		||||
					code.WriteRune(c)
 | 
			
		||||
				}
 | 
			
		||||
				intcode, err := strconv.ParseInt(code, 16, 64)
 | 
			
		||||
				intcode, err := strconv.ParseInt(code.String(), 16, 64)
 | 
			
		||||
				if err != nil {
 | 
			
		||||
					return "", errors.New("invalid unicode escape: \\U" + code)
 | 
			
		||||
					return "", errors.New("invalid unicode escape: \\U" + code.String())
 | 
			
		||||
				}
 | 
			
		||||
				growingString += string(rune(intcode))
 | 
			
		||||
				sb.WriteRune(rune(intcode))
 | 
			
		||||
			default:
 | 
			
		||||
				return "", errors.New("invalid escape sequence: \\" + string(l.peek()))
 | 
			
		||||
			}
 | 
			
		||||
@@ -534,7 +540,7 @@ func (l *tomlLexer) lexStringAsString(terminator string, discardLeadingNewLine,
 | 
			
		||||
				return "", fmt.Errorf("unescaped control character %U", r)
 | 
			
		||||
			}
 | 
			
		||||
			l.next()
 | 
			
		||||
			growingString += string(r)
 | 
			
		||||
			sb.WriteRune(r)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if l.peek() == eof {
 | 
			
		||||
@@ -769,19 +775,19 @@ func init() {
 | 
			
		||||
	// /!\ also matches the empty string
 | 
			
		||||
	//
 | 
			
		||||
	// Example matches:
 | 
			
		||||
	//1979-05-27T07:32:00Z
 | 
			
		||||
	//1979-05-27T00:32:00-07:00
 | 
			
		||||
	//1979-05-27T00:32:00.999999-07:00
 | 
			
		||||
	//1979-05-27 07:32:00Z
 | 
			
		||||
	//1979-05-27 00:32:00-07:00
 | 
			
		||||
	//1979-05-27 00:32:00.999999-07:00
 | 
			
		||||
	//1979-05-27T07:32:00
 | 
			
		||||
	//1979-05-27T00:32:00.999999
 | 
			
		||||
	//1979-05-27 07:32:00
 | 
			
		||||
	//1979-05-27 00:32:00.999999
 | 
			
		||||
	//1979-05-27
 | 
			
		||||
	//07:32:00
 | 
			
		||||
	//00:32:00.999999
 | 
			
		||||
	// 1979-05-27T07:32:00Z
 | 
			
		||||
	// 1979-05-27T00:32:00-07:00
 | 
			
		||||
	// 1979-05-27T00:32:00.999999-07:00
 | 
			
		||||
	// 1979-05-27 07:32:00Z
 | 
			
		||||
	// 1979-05-27 00:32:00-07:00
 | 
			
		||||
	// 1979-05-27 00:32:00.999999-07:00
 | 
			
		||||
	// 1979-05-27T07:32:00
 | 
			
		||||
	// 1979-05-27T00:32:00.999999
 | 
			
		||||
	// 1979-05-27 07:32:00
 | 
			
		||||
	// 1979-05-27 00:32:00.999999
 | 
			
		||||
	// 1979-05-27
 | 
			
		||||
	// 07:32:00
 | 
			
		||||
	// 00:32:00.999999
 | 
			
		||||
	dateRegexp = regexp.MustCompile(`^(?:\d{1,4}-\d{2}-\d{2})?(?:[T ]?\d{2}:\d{2}:\d{2}(\.\d{1,9})?(Z|[+-]\d{2}:\d{2})?)?`)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										35
									
								
								vendor/github.com/pelletier/go-toml/marshal.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										35
									
								
								vendor/github.com/pelletier/go-toml/marshal.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -76,6 +76,7 @@ var textUnmarshalerType = reflect.TypeOf(new(encoding.TextUnmarshaler)).Elem()
 | 
			
		||||
var localDateType = reflect.TypeOf(LocalDate{})
 | 
			
		||||
var localTimeType = reflect.TypeOf(LocalTime{})
 | 
			
		||||
var localDateTimeType = reflect.TypeOf(LocalDateTime{})
 | 
			
		||||
var mapStringInterfaceType = reflect.TypeOf(map[string]interface{}{})
 | 
			
		||||
 | 
			
		||||
// Check if the given marshal type maps to a Tree primitive
 | 
			
		||||
func isPrimitive(mtype reflect.Type) bool {
 | 
			
		||||
@@ -436,6 +437,7 @@ func (e *Encoder) valueToTree(mtype reflect.Type, mval reflect.Value) (*Tree, er
 | 
			
		||||
					if tree, ok := val.(*Tree); ok && mtypef.Anonymous && !opts.nameFromTag && !e.promoteAnon {
 | 
			
		||||
						e.appendTree(tval, tree)
 | 
			
		||||
					} else {
 | 
			
		||||
						val = e.wrapTomlValue(val, tval)
 | 
			
		||||
						tval.SetPathWithOptions([]string{opts.name}, SetOptions{
 | 
			
		||||
							Comment:   opts.comment,
 | 
			
		||||
							Commented: opts.commented,
 | 
			
		||||
@@ -474,6 +476,7 @@ func (e *Encoder) valueToTree(mtype reflect.Type, mval reflect.Value) (*Tree, er
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return nil, err
 | 
			
		||||
			}
 | 
			
		||||
			val = e.wrapTomlValue(val, tval)
 | 
			
		||||
			if e.quoteMapKeys {
 | 
			
		||||
				keyStr, err := tomlValueStringRepresentation(key.String(), "", "", e.order, e.arraysOneElementPerLine)
 | 
			
		||||
				if err != nil {
 | 
			
		||||
@@ -516,13 +519,13 @@ func (e *Encoder) valueToOtherSlice(mtype reflect.Type, mval reflect.Value) (int
 | 
			
		||||
 | 
			
		||||
// Convert given marshal value to toml value
 | 
			
		||||
func (e *Encoder) valueToToml(mtype reflect.Type, mval reflect.Value) (interface{}, error) {
 | 
			
		||||
	e.line++
 | 
			
		||||
	if mtype.Kind() == reflect.Ptr {
 | 
			
		||||
		switch {
 | 
			
		||||
		case isCustomMarshaler(mtype):
 | 
			
		||||
			return callCustomMarshaler(mval)
 | 
			
		||||
		case isTextMarshaler(mtype):
 | 
			
		||||
			return callTextMarshaler(mval)
 | 
			
		||||
			b, err := callTextMarshaler(mval)
 | 
			
		||||
			return string(b), err
 | 
			
		||||
		default:
 | 
			
		||||
			return e.valueToToml(mtype.Elem(), mval.Elem())
 | 
			
		||||
		}
 | 
			
		||||
@@ -534,7 +537,8 @@ func (e *Encoder) valueToToml(mtype reflect.Type, mval reflect.Value) (interface
 | 
			
		||||
	case isCustomMarshaler(mtype):
 | 
			
		||||
		return callCustomMarshaler(mval)
 | 
			
		||||
	case isTextMarshaler(mtype):
 | 
			
		||||
		return callTextMarshaler(mval)
 | 
			
		||||
		b, err := callTextMarshaler(mval)
 | 
			
		||||
		return string(b), err
 | 
			
		||||
	case isTree(mtype):
 | 
			
		||||
		return e.valueToTree(mtype, mval)
 | 
			
		||||
	case isOtherSequence(mtype), isCustomMarshalerSequence(mtype), isTextMarshalerSequence(mtype):
 | 
			
		||||
@@ -577,6 +581,25 @@ func (e *Encoder) appendTree(t, o *Tree) error {
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Create a toml value with the current line number as the position line
 | 
			
		||||
func (e *Encoder) wrapTomlValue(val interface{}, parent *Tree) interface{} {
 | 
			
		||||
	_, isTree := val.(*Tree)
 | 
			
		||||
	_, isTreeS := val.([]*Tree)
 | 
			
		||||
	if isTree || isTreeS {
 | 
			
		||||
		return val
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ret := &tomlValue{
 | 
			
		||||
		value: val,
 | 
			
		||||
		position: Position{
 | 
			
		||||
			e.line,
 | 
			
		||||
			parent.position.Col,
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
	e.line++
 | 
			
		||||
	return ret
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Unmarshal attempts to unmarshal the Tree into a Go struct pointed by v.
 | 
			
		||||
// Neither Unmarshaler interfaces nor UnmarshalTOML functions are supported for
 | 
			
		||||
// sub-structs, and only definite types can be unmarshaled.
 | 
			
		||||
@@ -681,6 +704,8 @@ func (d *Decoder) unmarshal(v interface{}) error {
 | 
			
		||||
 | 
			
		||||
	switch elem.Kind() {
 | 
			
		||||
	case reflect.Struct, reflect.Map:
 | 
			
		||||
	case reflect.Interface:
 | 
			
		||||
		elem = mapStringInterfaceType
 | 
			
		||||
	default:
 | 
			
		||||
		return errors.New("only a pointer to struct or map can be unmarshaled from TOML")
 | 
			
		||||
	}
 | 
			
		||||
@@ -717,6 +742,10 @@ func (d *Decoder) valueFromTree(mtype reflect.Type, tval *Tree, mval1 *reflect.V
 | 
			
		||||
	if mvalPtr := reflect.New(mtype); isCustomUnmarshaler(mvalPtr.Type()) {
 | 
			
		||||
		d.visitor.visitAll()
 | 
			
		||||
 | 
			
		||||
		if tval == nil {
 | 
			
		||||
			return mvalPtr.Elem(), nil
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if err := callCustomUnmarshaler(mvalPtr, tval.ToMap()); err != nil {
 | 
			
		||||
			return reflect.ValueOf(nil), fmt.Errorf("unmarshal toml: %v", err)
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										132
									
								
								vendor/github.com/pelletier/go-toml/toml.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										132
									
								
								vendor/github.com/pelletier/go-toml/toml.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -122,6 +122,89 @@ func (t *Tree) GetPath(keys []string) interface{} {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetArray returns the value at key in the Tree.
 | 
			
		||||
// It returns []string, []int64, etc type if key has homogeneous lists
 | 
			
		||||
// Key is a dot-separated path (e.g. a.b.c) without single/double quoted strings.
 | 
			
		||||
// Returns nil if the path does not exist in the tree.
 | 
			
		||||
// If keys is of length zero, the current tree is returned.
 | 
			
		||||
func (t *Tree) GetArray(key string) interface{} {
 | 
			
		||||
	if key == "" {
 | 
			
		||||
		return t
 | 
			
		||||
	}
 | 
			
		||||
	return t.GetArrayPath(strings.Split(key, "."))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetArrayPath returns the element in the tree indicated by 'keys'.
 | 
			
		||||
// If keys is of length zero, the current tree is returned.
 | 
			
		||||
func (t *Tree) GetArrayPath(keys []string) interface{} {
 | 
			
		||||
	if len(keys) == 0 {
 | 
			
		||||
		return t
 | 
			
		||||
	}
 | 
			
		||||
	subtree := t
 | 
			
		||||
	for _, intermediateKey := range keys[:len(keys)-1] {
 | 
			
		||||
		value, exists := subtree.values[intermediateKey]
 | 
			
		||||
		if !exists {
 | 
			
		||||
			return nil
 | 
			
		||||
		}
 | 
			
		||||
		switch node := value.(type) {
 | 
			
		||||
		case *Tree:
 | 
			
		||||
			subtree = node
 | 
			
		||||
		case []*Tree:
 | 
			
		||||
			// go to most recent element
 | 
			
		||||
			if len(node) == 0 {
 | 
			
		||||
				return nil
 | 
			
		||||
			}
 | 
			
		||||
			subtree = node[len(node)-1]
 | 
			
		||||
		default:
 | 
			
		||||
			return nil // cannot navigate through other node types
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	// branch based on final node type
 | 
			
		||||
	switch node := subtree.values[keys[len(keys)-1]].(type) {
 | 
			
		||||
	case *tomlValue:
 | 
			
		||||
		switch n := node.value.(type) {
 | 
			
		||||
		case []interface{}:
 | 
			
		||||
			return getArray(n)
 | 
			
		||||
		default:
 | 
			
		||||
			return node.value
 | 
			
		||||
		}
 | 
			
		||||
	default:
 | 
			
		||||
		return node
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// if homogeneous array, then return slice type object over []interface{}
 | 
			
		||||
func getArray(n []interface{}) interface{} {
 | 
			
		||||
	var s []string
 | 
			
		||||
	var i64 []int64
 | 
			
		||||
	var f64 []float64
 | 
			
		||||
	var bl []bool
 | 
			
		||||
	for _, value := range n {
 | 
			
		||||
		switch v := value.(type) {
 | 
			
		||||
		case string:
 | 
			
		||||
			s = append(s, v)
 | 
			
		||||
		case int64:
 | 
			
		||||
			i64 = append(i64, v)
 | 
			
		||||
		case float64:
 | 
			
		||||
			f64 = append(f64, v)
 | 
			
		||||
		case bool:
 | 
			
		||||
			bl = append(bl, v)
 | 
			
		||||
		default:
 | 
			
		||||
			return n
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if len(s) == len(n) {
 | 
			
		||||
		return s
 | 
			
		||||
	} else if len(i64) == len(n) {
 | 
			
		||||
		return i64
 | 
			
		||||
	} else if len(f64) == len(n) {
 | 
			
		||||
		return f64
 | 
			
		||||
	} else if len(bl) == len(n) {
 | 
			
		||||
		return bl
 | 
			
		||||
	}
 | 
			
		||||
	return n
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetPosition returns the position of the given key.
 | 
			
		||||
func (t *Tree) GetPosition(key string) Position {
 | 
			
		||||
	if key == "" {
 | 
			
		||||
@@ -130,6 +213,50 @@ func (t *Tree) GetPosition(key string) Position {
 | 
			
		||||
	return t.GetPositionPath(strings.Split(key, "."))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SetPositionPath sets the position of element in the tree indicated by 'keys'.
 | 
			
		||||
// If keys is of length zero, the current tree position is set.
 | 
			
		||||
func (t *Tree) SetPositionPath(keys []string, pos Position) {
 | 
			
		||||
	if len(keys) == 0 {
 | 
			
		||||
		t.position = pos
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	subtree := t
 | 
			
		||||
	for _, intermediateKey := range keys[:len(keys)-1] {
 | 
			
		||||
		value, exists := subtree.values[intermediateKey]
 | 
			
		||||
		if !exists {
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		switch node := value.(type) {
 | 
			
		||||
		case *Tree:
 | 
			
		||||
			subtree = node
 | 
			
		||||
		case []*Tree:
 | 
			
		||||
			// go to most recent element
 | 
			
		||||
			if len(node) == 0 {
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
			subtree = node[len(node)-1]
 | 
			
		||||
		default:
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	// branch based on final node type
 | 
			
		||||
	switch node := subtree.values[keys[len(keys)-1]].(type) {
 | 
			
		||||
	case *tomlValue:
 | 
			
		||||
		node.position = pos
 | 
			
		||||
		return
 | 
			
		||||
	case *Tree:
 | 
			
		||||
		node.position = pos
 | 
			
		||||
		return
 | 
			
		||||
	case []*Tree:
 | 
			
		||||
		// go to most recent element
 | 
			
		||||
		if len(node) == 0 {
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		node[len(node)-1].position = pos
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetPositionPath returns the element in the tree indicated by 'keys'.
 | 
			
		||||
// If keys is of length zero, the current tree is returned.
 | 
			
		||||
func (t *Tree) GetPositionPath(keys []string) Position {
 | 
			
		||||
@@ -212,7 +339,8 @@ func (t *Tree) SetPathWithOptions(keys []string, opts SetOptions, value interfac
 | 
			
		||||
			// go to most recent element
 | 
			
		||||
			if len(node) == 0 {
 | 
			
		||||
				// create element if it does not exist
 | 
			
		||||
				subtree.values[intermediateKey] = append(node, newTreeWithPosition(Position{Line: t.position.Line + i, Col: t.position.Col}))
 | 
			
		||||
				node = append(node, newTreeWithPosition(Position{Line: t.position.Line + i, Col: t.position.Col}))
 | 
			
		||||
				subtree.values[intermediateKey] = node
 | 
			
		||||
			}
 | 
			
		||||
			subtree = node[len(node)-1]
 | 
			
		||||
		}
 | 
			
		||||
@@ -232,6 +360,8 @@ func (t *Tree) SetPathWithOptions(keys []string, opts SetOptions, value interfac
 | 
			
		||||
		toInsert = value
 | 
			
		||||
	case *tomlValue:
 | 
			
		||||
		v.comment = opts.Comment
 | 
			
		||||
		v.commented = opts.Commented
 | 
			
		||||
		v.multiline = opts.Multiline
 | 
			
		||||
		toInsert = v
 | 
			
		||||
	default:
 | 
			
		||||
		toInsert = &tomlValue{value: value,
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								vendor/github.com/pelletier/go-toml/tomltree_create.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								vendor/github.com/pelletier/go-toml/tomltree_create.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -57,6 +57,19 @@ func simpleValueCoercion(object interface{}) (interface{}, error) {
 | 
			
		||||
		return float64(original), nil
 | 
			
		||||
	case fmt.Stringer:
 | 
			
		||||
		return original.String(), nil
 | 
			
		||||
	case []interface{}:
 | 
			
		||||
		value := reflect.ValueOf(original)
 | 
			
		||||
		length := value.Len()
 | 
			
		||||
		arrayValue := reflect.MakeSlice(value.Type(), 0, length)
 | 
			
		||||
		for i := 0; i < length; i++ {
 | 
			
		||||
			val := value.Index(i).Interface()
 | 
			
		||||
			simpleValue, err := simpleValueCoercion(val)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return nil, err
 | 
			
		||||
			}
 | 
			
		||||
			arrayValue = reflect.Append(arrayValue, reflect.ValueOf(simpleValue))
 | 
			
		||||
		}
 | 
			
		||||
		return arrayValue.Interface(), nil
 | 
			
		||||
	default:
 | 
			
		||||
		return nil, fmt.Errorf("cannot convert type %T to Tree", object)
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/github.com/pelletier/go-toml/tomltree_write.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/pelletier/go-toml/tomltree_write.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -163,7 +163,7 @@ func tomlValueStringRepresentation(v interface{}, commented string, indent strin
 | 
			
		||||
		return "\"" + encodeTomlString(value) + "\"", nil
 | 
			
		||||
	case []byte:
 | 
			
		||||
		b, _ := v.([]byte)
 | 
			
		||||
		return tomlValueStringRepresentation(string(b), commented, indent, ord, arraysOneElementPerLine)
 | 
			
		||||
		return string(b), nil
 | 
			
		||||
	case bool:
 | 
			
		||||
		if value {
 | 
			
		||||
			return "true", nil
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user