Skip to content

Commit c98043f

Browse files
committed
Update vendor ini to go-ini/init@12f418c.
Remove unused vendor vaughan0/go-ini.
1 parent f7b182a commit c98043f

21 files changed

Lines changed: 2111 additions & 1414 deletions

File tree

ecs-cli/license/license.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -906,22 +906,4 @@ limitations under the License.
906906
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
907907
See the License for the specific language governing permissions and
908908
limitations under the License.
909-
910-
***
911-
./../vendor/src/github.com/vaughan0/go-ini
912-
913-
Copyright (c) 2013 Vaughan Newton
914-
915-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
916-
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
917-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
918-
persons to whom the Software is furnished to do so, subject to the following conditions:
919-
920-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
921-
Software.
922-
923-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
924-
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
925-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
926-
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
927909
`

ecs-cli/modules/compose/ecs/mocks/project_entity.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ func (_mr *_MockProjectEntityRecorder) Info(arg0 interface{}) *gomock.Call {
8787
return _mr.mock.ctrl.RecordCall(_mr.mock, "Info", arg0)
8888
}
8989

90+
func (_m *MockProjectEntity) LoadContext() error {
91+
ret := _m.ctrl.Call(_m, "LoadContext")
92+
ret0, _ := ret[0].(error)
93+
return ret0
94+
}
95+
96+
func (_mr *_MockProjectEntityRecorder) LoadContext() *gomock.Call {
97+
return _mr.mock.ctrl.RecordCall(_mr.mock, "LoadContext")
98+
}
99+
90100
func (_m *MockProjectEntity) Run(_param0 map[string]string) error {
91101
ret := _m.ctrl.Call(_m, "Run", _param0)
92102
ret0, _ := ret[0].(error)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.PHONY: build test bench vet
2+
3+
build: vet bench
4+
5+
test:
6+
go test -v -cover -race
7+
8+
bench:
9+
go test -v -cover -race -test.bench=. -test.benchmem
10+
11+
vet:
12+
go vet

ecs-cli/vendor/src/github.com/go-ini/ini/README.md

Lines changed: 101 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,24 @@ Package ini provides INI file read and write functionality in Go.
2222

2323
## Installation
2424

25+
To use a tagged revision:
26+
2527
go get gopkg.in/ini.v1
2628

29+
To use with latest changes:
30+
31+
go get github.com/go-ini/ini
32+
33+
Please add `-u` flag to update in the future.
34+
35+
### Testing
36+
37+
If you want to test on your machine, please apply `-t` flag:
38+
39+
go get -t gopkg.in/ini.v1
40+
41+
Please add `-u` flag to update in the future.
42+
2743
## Getting Started
2844

2945
### Loading from data sources
@@ -46,6 +62,14 @@ When you cannot decide how many data sources to load at the beginning, you still
4662
err := cfg.Append("other file", []byte("other raw data"))
4763
```
4864

65+
If you have a list of files with possibilities that some of them may not available at the time, and you don't know exactly which ones, you can use `LooseLoad` to ignore nonexistent files without returning error.
66+
67+
```go
68+
cfg, err := ini.LooseLoad("filename", "filename_404")
69+
```
70+
71+
The cool thing is, whenever the file is available to load while you're calling `Reload` method, it will be counted as usual.
72+
4973
### Working with sections
5074

5175
To get a section, you would need to:
@@ -95,6 +119,12 @@ Same rule applies to key operations:
95119
key := cfg.Section("").Key("key name")
96120
```
97121

122+
To check if a key exists:
123+
124+
```go
125+
yes := cfg.Section("").HasKey("key name")
126+
```
127+
98128
To create a new key:
99129

100130
```go
@@ -122,23 +152,50 @@ To get a string value:
122152
val := cfg.Section("").Key("key name").String()
123153
```
124154

155+
To validate key value on the fly:
156+
157+
```go
158+
val := cfg.Section("").Key("key name").Validate(func(in string) string {
159+
if len(in) == 0 {
160+
return "default"
161+
}
162+
return in
163+
})
164+
```
165+
166+
If you do not want any auto-transformation (such as recursive read) for the values, you can get raw value directly (this way you get much better performance):
167+
168+
```go
169+
val := cfg.Section("").Key("key name").Value()
170+
```
171+
172+
To check if raw value exists:
173+
174+
```go
175+
yes := cfg.Section("").HasValue("test value")
176+
```
177+
125178
To get value with types:
126179

127180
```go
128181
// For boolean values:
129-
// true when value is: 1, t, T, TRUE, true, True, YES, yes, Yes, ON, on, On
130-
// false when value is: 0, f, F, FALSE, false, False, NO, no, No, OFF, off, Off
182+
// true when value is: 1, t, T, TRUE, true, True, YES, yes, Yes, y, ON, on, On
183+
// false when value is: 0, f, F, FALSE, false, False, NO, no, No, n, OFF, off, Off
131184
v, err = cfg.Section("").Key("BOOL").Bool()
132185
v, err = cfg.Section("").Key("FLOAT64").Float64()
133186
v, err = cfg.Section("").Key("INT").Int()
134187
v, err = cfg.Section("").Key("INT64").Int64()
188+
v, err = cfg.Section("").Key("UINT").Uint()
189+
v, err = cfg.Section("").Key("UINT64").Uint64()
135190
v, err = cfg.Section("").Key("TIME").TimeFormat(time.RFC3339)
136191
v, err = cfg.Section("").Key("TIME").Time() // RFC3339
137192

138193
v = cfg.Section("").Key("BOOL").MustBool()
139194
v = cfg.Section("").Key("FLOAT64").MustFloat64()
140195
v = cfg.Section("").Key("INT").MustInt()
141196
v = cfg.Section("").Key("INT64").MustInt64()
197+
v = cfg.Section("").Key("UINT").MustUint()
198+
v = cfg.Section("").Key("UINT64").MustUint64()
142199
v = cfg.Section("").Key("TIME").MustTimeFormat(time.RFC3339)
143200
v = cfg.Section("").Key("TIME").MustTime() // RFC3339
144201

@@ -151,6 +208,8 @@ v = cfg.Section("").Key("BOOL").MustBool(true)
151208
v = cfg.Section("").Key("FLOAT64").MustFloat64(1.25)
152209
v = cfg.Section("").Key("INT").MustInt(10)
153210
v = cfg.Section("").Key("INT64").MustInt64(99)
211+
v = cfg.Section("").Key("UINT").MustUint(3)
212+
v = cfg.Section("").Key("UINT64").MustUint64(6)
154213
v = cfg.Section("").Key("TIME").MustTimeFormat(time.RFC3339, time.Now())
155214
v = cfg.Section("").Key("TIME").MustTime(time.Now()) // RFC3339
156215
```
@@ -192,7 +251,7 @@ Piece of cake!
192251

193252
```go
194253
cfg.Section("advance").Key("two_lines").String() // how about continuation lines?
195-
cfg.Section("advance").Key("lots_of_lines").String() // 1 2 3 4
254+
cfg.Section("advance").Key("lots_of_lines").String() // 1 2 3 4
196255
```
197256

198257
Note that single quotes around values will be stripped:
@@ -213,6 +272,8 @@ v = cfg.Section("").Key("STRING").In("default", []string{"str", "arr", "types"})
213272
v = cfg.Section("").Key("FLOAT64").InFloat64(1.1, []float64{1.25, 2.5, 3.75})
214273
v = cfg.Section("").Key("INT").InInt(5, []int{10, 20, 30})
215274
v = cfg.Section("").Key("INT64").InInt64(10, []int64{10, 20, 30})
275+
v = cfg.Section("").Key("UINT").InUint(4, []int{3, 6, 9})
276+
v = cfg.Section("").Key("UINT64").InUint64(8, []int64{3, 6, 9})
216277
v = cfg.Section("").Key("TIME").InTimeFormat(time.RFC3339, time.Now(), []time.Time{time1, time2, time3})
217278
v = cfg.Section("").Key("TIME").InTime(time.Now(), []time.Time{time1, time2, time3}) // RFC3339
218279
```
@@ -225,20 +286,54 @@ To validate value in a given range:
225286
vals = cfg.Section("").Key("FLOAT64").RangeFloat64(0.0, 1.1, 2.2)
226287
vals = cfg.Section("").Key("INT").RangeInt(0, 10, 20)
227288
vals = cfg.Section("").Key("INT64").RangeInt64(0, 10, 20)
289+
vals = cfg.Section("").Key("UINT").RangeUint(0, 3, 9)
290+
vals = cfg.Section("").Key("UINT64").RangeUint64(0, 3, 9)
228291
vals = cfg.Section("").Key("TIME").RangeTimeFormat(time.RFC3339, time.Now(), minTime, maxTime)
229292
vals = cfg.Section("").Key("TIME").RangeTime(time.Now(), minTime, maxTime) // RFC3339
230293
```
231294

232-
To auto-split value into slice:
295+
##### Auto-split values into a slice
296+
297+
To use zero value of type for invalid inputs:
233298

234299
```go
300+
// Input: 1.1, 2.2, 3.3, 4.4 -> [1.1 2.2 3.3 4.4]
301+
// Input: how, 2.2, are, you -> [0.0 2.2 0.0 0.0]
235302
vals = cfg.Section("").Key("STRINGS").Strings(",")
236303
vals = cfg.Section("").Key("FLOAT64S").Float64s(",")
237304
vals = cfg.Section("").Key("INTS").Ints(",")
238305
vals = cfg.Section("").Key("INT64S").Int64s(",")
306+
vals = cfg.Section("").Key("UINTS").Uints(",")
307+
vals = cfg.Section("").Key("UINT64S").Uint64s(",")
239308
vals = cfg.Section("").Key("TIMES").Times(",")
240309
```
241310

311+
To exclude invalid values out of result slice:
312+
313+
```go
314+
// Input: 1.1, 2.2, 3.3, 4.4 -> [1.1 2.2 3.3 4.4]
315+
// Input: how, 2.2, are, you -> [2.2]
316+
vals = cfg.Section("").Key("FLOAT64S").ValidFloat64s(",")
317+
vals = cfg.Section("").Key("INTS").ValidInts(",")
318+
vals = cfg.Section("").Key("INT64S").ValidInt64s(",")
319+
vals = cfg.Section("").Key("UINTS").ValidUints(",")
320+
vals = cfg.Section("").Key("UINT64S").ValidUint64s(",")
321+
vals = cfg.Section("").Key("TIMES").ValidTimes(",")
322+
```
323+
324+
Or to return nothing but error when have invalid inputs:
325+
326+
```go
327+
// Input: 1.1, 2.2, 3.3, 4.4 -> [1.1 2.2 3.3 4.4]
328+
// Input: how, 2.2, are, you -> error
329+
vals = cfg.Section("").Key("FLOAT64S").StrictFloat64s(",")
330+
vals = cfg.Section("").Key("INTS").StrictInts(",")
331+
vals = cfg.Section("").Key("INT64S").StrictInt64s(",")
332+
vals = cfg.Section("").Key("UINTS").StrictUints(",")
333+
vals = cfg.Section("").Key("UINT64S").StrictUint64s(",")
334+
vals = cfg.Section("").Key("TIMES").StrictTimes(",")
335+
```
336+
242337
### Save your configuration
243338

244339
Finally, it's time to save your configuration to somewhere.
@@ -421,7 +516,7 @@ GPA = 2.8
421516
[Embeded]
422517
Dates = 2015-08-07T22:14:22+08:00|2015-08-07T22:14:22+08:00
423518
Places = HangZhou,Boston
424-
None =
519+
None =
425520
```
426521

427522
#### Name Mapper
@@ -441,7 +536,7 @@ type Info struct {
441536
}
442537

443538
func main() {
444-
err = ini.MapToWithMapper(&Info{}, ini.TitleUnderscore, []byte("packag_name=ini"))
539+
err = ini.MapToWithMapper(&Info{}, ini.TitleUnderscore, []byte("package_name=ini"))
445540
// ...
446541

447542
cfg, err := ini.Load([]byte("PACKAGE_NAME=ini"))

0 commit comments

Comments
 (0)