Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go mod tidy & goimports -w #877

Open
wants to merge 1 commit into
base: v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apic.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
//
//
// Copyright (c) 2011-2019 Canonical Ltd
// Copyright (c) 2006-2010 Kirill Simonov
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down
12 changes: 6 additions & 6 deletions decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ var unmarshalErrorTests = []struct {
{"%TAG !%79! tag:yaml.org,2002:\n---\nv: !%79!int '1'", "yaml: did not find expected whitespace"},
{"a:\n 1:\nb\n 2:", ".*could not find expected ':'"},
{"a: 1\nb: 2\nc 2\nd: 3\n", "^yaml: line 3: could not find expected ':'$"},
{"#\n-\n{", "yaml: line 3: could not find expected ':'"}, // Issue #665
{"#\n-\n{", "yaml: line 3: could not find expected ':'"}, // Issue #665
{"0: [:!00 \xef", "yaml: incomplete UTF-8 octet sequence"}, // Issue #666
{
"a: &a [00,00,00,00,00,00,00,00,00]\n" +
Expand Down Expand Up @@ -1482,7 +1482,7 @@ func (s *S) TestMergeNestedStruct(c *C) {
// 2) A simple implementation might attempt to handle the key skipping
// directly by iterating over the merging map without recursion, but
// there are more complex cases that require recursion.
//
//
// Quick summary of the fields:
//
// - A must come from outer and not overriden
Expand All @@ -1498,7 +1498,7 @@ func (s *S) TestMergeNestedStruct(c *C) {
A, B, C int
}
type Outer struct {
D, E int
D, E int
Inner Inner
Inline map[string]int `yaml:",inline"`
}
Expand All @@ -1516,10 +1516,10 @@ func (s *S) TestMergeNestedStruct(c *C) {
// Repeat test with a map.

var testm map[string]interface{}
var wantm = map[string]interface {} {
"f": 60,
var wantm = map[string]interface{}{
"f": 60,
"inner": map[string]interface{}{
"a": 10,
"a": 10,
},
"d": 40,
"e": 50,
Expand Down
2 changes: 1 addition & 1 deletion emitterc.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool
emitter.indent += 2
} else {
// Everything else aligns to the chosen indentation.
emitter.indent = emitter.best_indent*((emitter.indent+emitter.best_indent)/emitter.best_indent)
emitter.indent = emitter.best_indent * ((emitter.indent + emitter.best_indent) / emitter.best_indent)
}
}
return true
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module "gopkg.in/yaml.v3"
module gopkg.in/yaml.v3

require (
"gopkg.in/check.v1" v0.0.0-20161208181325-20d25e280405
)
go 1.16

require gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
41 changes: 21 additions & 20 deletions node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ import (
"fmt"
"os"

. "gopkg.in/check.v1"
"gopkg.in/yaml.v3"
"io"
"strings"

. "gopkg.in/check.v1"
"gopkg.in/yaml.v3"
)

var nodeTests = []struct {
Expand Down Expand Up @@ -688,17 +689,17 @@ var nodeTests = []struct {
Line: 3,
Column: 4,
}, {
Kind: yaml.ScalarNode,
Tag: "!!str",
Value: "c",
Kind: yaml.ScalarNode,
Tag: "!!str",
Value: "c",
LineComment: "# IC",
Line: 5,
Column: 1,
Line: 5,
Column: 1,
}, {
Kind: yaml.SequenceNode,
Tag: "!!seq",
Line: 6,
Column: 3,
Kind: yaml.SequenceNode,
Tag: "!!seq",
Line: 6,
Column: 3,
Content: []*yaml.Node{{
Kind: yaml.ScalarNode,
Tag: "!!str",
Expand All @@ -707,17 +708,17 @@ var nodeTests = []struct {
Column: 5,
}},
}, {
Kind: yaml.ScalarNode,
Tag: "!!str",
Value: "d",
Kind: yaml.ScalarNode,
Tag: "!!str",
Value: "d",
LineComment: "# ID",
Line: 7,
Column: 1,
Line: 7,
Column: 1,
}, {
Kind: yaml.MappingNode,
Tag: "!!map",
Line: 8,
Column: 3,
Kind: yaml.MappingNode,
Tag: "!!map",
Line: 8,
Column: 3,
Content: []*yaml.Node{{
Kind: yaml.ScalarNode,
Tag: "!!str",
Expand Down
8 changes: 4 additions & 4 deletions readerc.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
//
//
// Copyright (c) 2011-2019 Canonical Ltd
// Copyright (c) 2006-2010 Kirill Simonov
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down
8 changes: 4 additions & 4 deletions scannerc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2847,7 +2847,7 @@ func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t
continue
}
if parser.buffer[parser.buffer_pos+peek] == '#' {
seen := parser.mark.index+peek
seen := parser.mark.index + peek
for {
if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
return false
Expand Down Expand Up @@ -2876,7 +2876,7 @@ func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t
parser.comments = append(parser.comments, yaml_comment_t{
token_mark: token_mark,
start_mark: start_mark,
line: text,
line: text,
})
}
return true
Expand Down Expand Up @@ -2910,7 +2910,7 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo
// the foot is the line below it.
var foot_line = -1
if scan_mark.line > 0 {
foot_line = parser.mark.line-parser.newlines+1
foot_line = parser.mark.line - parser.newlines + 1
if parser.newlines == 0 && parser.mark.column > 1 {
foot_line++
}
Expand Down Expand Up @@ -2996,7 +2996,7 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo
recent_empty = false

// Consume until after the consumed comment line.
seen := parser.mark.index+peek
seen := parser.mark.index + peek
for {
if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
return false
Expand Down
3 changes: 2 additions & 1 deletion suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
package yaml_test

import (
. "gopkg.in/check.v1"
"testing"

. "gopkg.in/check.v1"
)

func Test(t *testing.T) { TestingT(t) }
Expand Down
8 changes: 4 additions & 4 deletions writerc.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
//
//
// Copyright (c) 2011-2019 Canonical Ltd
// Copyright (c) 2006-2010 Kirill Simonov
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down
5 changes: 2 additions & 3 deletions yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ const (
// Address yaml.Node
// }
// err := yaml.Unmarshal(data, &person)
//
//
// Or by itself:
//
// var person Node
Expand All @@ -373,7 +373,7 @@ type Node struct {
// Kind defines whether the node is a document, a mapping, a sequence,
// a scalar value, or an alias to another node. The specific data type of
// scalar nodes may be obtained via the ShortTag and LongTag methods.
Kind Kind
Kind Kind

// Style allows customizing the apperance of the node in the tree.
Style Style
Expand Down Expand Up @@ -421,7 +421,6 @@ func (n *Node) IsZero() bool {
n.HeadComment == "" && n.LineComment == "" && n.FootComment == "" && n.Line == 0 && n.Column == 0
}


// LongTag returns the long form of the tag that indicates the data type for
// the node. If the Tag field isn't explicitly defined, one will be computed
// based on the node properties.
Expand Down
1 change: 0 additions & 1 deletion yamlh.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,6 @@ type yaml_parser_t struct {
}

type yaml_comment_t struct {

scan_mark yaml_mark_t // Position where scanning for comments started
token_mark yaml_mark_t // Position after which tokens will be associated with this comment
start_mark yaml_mark_t // Position of '#' comment mark
Expand Down
20 changes: 10 additions & 10 deletions yamlprivateh.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
//
//
// Copyright (c) 2011-2019 Canonical Ltd
// Copyright (c) 2006-2010 Kirill Simonov
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -137,8 +137,8 @@ func is_crlf(b []byte, i int) bool {
func is_breakz(b []byte, i int) bool {
//return is_break(b, i) || is_z(b, i)
return (
// is_break:
b[i] == '\r' || // CR (#xD)
// is_break:
b[i] == '\r' || // CR (#xD)
b[i] == '\n' || // LF (#xA)
b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85)
b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028)
Expand All @@ -151,8 +151,8 @@ func is_breakz(b []byte, i int) bool {
func is_spacez(b []byte, i int) bool {
//return is_space(b, i) || is_breakz(b, i)
return (
// is_space:
b[i] == ' ' ||
// is_space:
b[i] == ' ' ||
// is_breakz:
b[i] == '\r' || // CR (#xD)
b[i] == '\n' || // LF (#xA)
Expand All @@ -166,8 +166,8 @@ func is_spacez(b []byte, i int) bool {
func is_blankz(b []byte, i int) bool {
//return is_blank(b, i) || is_breakz(b, i)
return (
// is_blank:
b[i] == ' ' || b[i] == '\t' ||
// is_blank:
b[i] == ' ' || b[i] == '\t' ||
// is_breakz:
b[i] == '\r' || // CR (#xD)
b[i] == '\n' || // LF (#xA)
Expand Down