forked from segmentio/golines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
end_to_end__exp.go
157 lines (136 loc) · 3.37 KB
/
end_to_end__exp.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
package fixtures
import "fmt"
var (
abc = []string{
"a really long string",
"another really long string",
"a third really long string",
"a fourth really long string",
fmt.Sprintf(
"%s %s %s %s >>>>> %s %s",
"first argument",
"second argument",
"third argument",
"fourth argument",
"fifth argument",
"sixth argument",
),
}
)
type MyStruct struct {
aLongProperty int `help:"This is a really long string for this property"`
anotherLongProperty int `help:"This is a really long string for this property, part 2"`
athirdLongProperty int `help:"This is a really long string for this property, part 3...."`
}
type MyInterface interface {
aReallyLongFunctionName(
argument1 string,
argument2 string,
argument3 string,
argument4 string,
argument5 string,
argument6 string,
) (string, error)
}
// Something here
// Another comment
// A third comment
// This is a really really long comment that needs to be split up into multiple lines. I don't know
// how easy it will be to do, but I think we can do it!
func longLine(
aReallyLongName string,
anotherLongName string,
aThirdLongName string,
) (string, error) {
argument1 := "argument1"
argument2 := "argument2"
argument3 := "argument3"
argument4 := "argument4"
fmt.Printf(
"This is a really long string with a bunch of arguments: %s %s %s %s >>>>>>>>>>>>>>>>>>>>>>",
argument1,
argument2,
argument3,
argument4,
)
fmt.Printf("This is a short statement: %d %d %d", 1, 2, 3)
z := argument1 + argument2 + fmt.Sprintf(
"This is a really long statement that should be broken up %s %s %s",
argument1,
argument2,
argument3,
)
fmt.Printf(
"This is a really long line that can be broken up twice %s %s",
fmt.Sprintf(
"This is a really long sub-line that should be broken up more because %s %s",
argument1,
argument2,
),
fmt.Sprintf("A short one %d", 3),
)
fmt.Print(
"This is a function with a really long single argument. We want to see if it's properly split",
)
fmt.Println(z)
// This is a really long comment on an indented line. Do you think we can split it up or should
// we just leave it as is?
if argument4 == "5" {
return "", fmt.Errorf(
"a very long query with ID %d failed. Check Query History in AWS UI",
12341251,
)
}
go func() {
fmt.Printf(
"This is a really long line inside of a go routine call. It should be split if at all possible.",
)
}()
if "hello this is a big string" == "this is a small string" &&
"this is another big string" == "this is an even bigger string >>>" {
fmt.Print("inside if statement")
}
fmt.Println(
map[string]string{
"key1": "a very long value",
"key2": "a very long value",
"key3": "another very long value",
},
)
return "", nil
}
func shortFunc(a int, b int) error {
c := make(chan int)
for {
select {
case <-c:
switch a {
case 1:
return fmt.Errorf(
"This is a really long line that can be broken up twice %s %s",
fmt.Sprintf(
"This is a really long sub-line that should be broken up more because %s %s",
"xxxx",
"yyyy",
),
fmt.Sprintf("A short one %d", 3),
)
case 2:
}
}
break
}
if a > 5 {
panic(
fmt.Sprintf(
">>>>>>>>>>>>>>>>>>> %s %s %s %s",
"really long argument",
"another really long argument",
"a third really long arguement",
abc[1:2],
),
)
}
return nil
// This is an end decoration
}