Skip to content

Commit a994308

Browse files
authored
Rm robots comment (#23)
1 parent 7069a2a commit a994308

File tree

8 files changed

+63
-68
lines changed

8 files changed

+63
-68
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
bin
22
dist
33
coverage.txt
4+
.vscode

README.md

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ In Go, variables declared without an explicit initial value are given their zero
1717

1818
## Inspiration
1919

20-
* Java [Optional](https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html)
21-
* [https://github.com/leighmcculloch/go-optional](https://github.com/leighmcculloch/go-optional)
22-
* [https://github.com/golang/go/issues/7054](https://github.com/golang/go/issues/7054)
20+
- Java [Optional](https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html)
21+
- [https://github.com/leighmcculloch/go-optional](https://github.com/leighmcculloch/go-optional)
22+
- [https://github.com/golang/go/issues/7054](https://github.com/golang/go/issues/7054)
2323

2424
## Tool
2525

@@ -55,50 +55,50 @@ and output file is optional_t.go. This can be overridden with the -output flag.
5555

5656
## Library
5757

58-
* [bool](bool.go)
59-
* [byte](byte.go)
60-
* [complex128](complex128.go)
61-
* [complex64](complex64.go)
62-
* [float32](float32.go)
63-
* [float64](float64.go)
64-
* [int](int.go)
65-
* [int16](int16.go)
66-
* [int32](int32.go)
67-
* [int64](int64.go)
68-
* [int8](int8.go)
69-
* [rune](rune.go)
70-
* [string](string.go)
71-
* [uint](uint.go)
72-
* [uint16](uint16.go)
73-
* [uint32](uint32.go)
74-
* [uint64](uint64.go)
75-
* [uint8](uint8.go)
76-
* [uintptr](uintptr.go)
77-
* [error](error.go)
58+
- [bool](bool.go)
59+
- [byte](byte.go)
60+
- [complex128](complex128.go)
61+
- [complex64](complex64.go)
62+
- [float32](float32.go)
63+
- [float64](float64.go)
64+
- [int](int.go)
65+
- [int16](int16.go)
66+
- [int32](int32.go)
67+
- [int64](int64.go)
68+
- [int8](int8.go)
69+
- [rune](rune.go)
70+
- [string](string.go)
71+
- [uint](uint.go)
72+
- [uint16](uint16.go)
73+
- [uint32](uint32.go)
74+
- [uint64](uint64.go)
75+
- [uint8](uint8.go)
76+
- [uintptr](uintptr.go)
77+
- [error](error.go)
7878

7979
### Usage
8080

8181
```go
8282
package main
8383

8484
import (
85-
"fmt"
85+
"fmt"
8686

87-
"github.com/markphelps/optional"
87+
"github.com/markphelps/optional"
8888
)
8989

9090
func main() {
91-
s := optional.NewString("foo")
91+
s := optional.NewString("foo")
9292

93-
value, err := s.Get()
94-
if err != nil {
95-
// handle error!
96-
} else {
97-
fmt.Println(value)
98-
}
93+
value, err := s.Get()
94+
if err != nil {
95+
// handle error!
96+
} else {
97+
fmt.Println(value)
98+
}
9999

100-
t := optional.String{}
101-
fmt.Println(t.OrElse("bar"))
100+
t := optional.String{}
101+
fmt.Println(t.OrElse("bar"))
102102
}
103103
```
104104

@@ -118,21 +118,21 @@ Option types marshal to/from JSON as you would expect:
118118
package main
119119

120120
import (
121-
"encoding/json"
122-
"fmt"
121+
"encoding/json"
122+
"fmt"
123123
)
124124

125125
func main() {
126-
var value = struct {
127-
Field optional.String `json:"field,omitempty"`
128-
}{
129-
Field: optional.NewString("bar"),
130-
}
126+
var value = struct {
127+
Field optional.String `json:"field,omitempty"`
128+
}{
129+
Field: optional.NewString("bar"),
130+
}
131131

132-
out, _ := json.Marshal(value)
132+
out, _ := json.Marshal(value)
133133

134-
fmt.Println(string(out))
135-
// outputs: {"field":"bar"}
134+
fmt.Println(string(out))
135+
// outputs: {"field":"bar"}
136136
}
137137
```
138138

@@ -142,21 +142,21 @@ func main() {
142142
package main
143143

144144
import (
145-
"encoding/json"
146-
"fmt"
145+
"encoding/json"
146+
"fmt"
147147
)
148148

149149
func main() {
150-
var value = &struct {
151-
Field optional.String `json:"field,omitempty"`
152-
}{}
150+
var value = &struct {
151+
Field optional.String `json:"field,omitempty"`
152+
}{}
153153

154-
_ = json.Unmarshal([]byte(`{"field":"bar"}`), value)
154+
_ = json.Unmarshal([]byte(`{"field":"bar"}`), value)
155155

156-
value.Field.If(func(s string) {
157-
fmt.Println(s)
158-
})
159-
// outputs: bar
156+
value.Field.If(func(s string) {
157+
fmt.Println(s)
158+
})
159+
// outputs: bar
160160
}
161161
```
162162

@@ -168,8 +168,8 @@ As you can see test coverage is a bit lacking for the library. This is simply be
168168

169169
Also checkout:
170170

171-
* [example_test.go](example_test.go) for example usage.
172-
* [cmd/optional/golden_test.go](cmd/optional/golden_test.go) for [golden file](https://medium.com/soon-london/testing-with-golden-files-in-go-7fccc71c43d3) based testing of the generator itself.
171+
- [example_test.go](example_test.go) for example usage.
172+
- [cmd/optional/golden_test.go](cmd/optional/golden_test.go) for [golden file](https://medium.com/soon-london/testing-with-golden-files-in-go-7fccc71c43d3) based testing of the generator itself.
173173

174174
### Golden Files
175175

cmd/optional/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ func main() {
125125
}
126126
}
127127

128-
const tmpl = `// Code generated by go generate
129-
// This file was generated by robots at {{ .Timestamp }}
128+
const tmpl = `// Code generated by 'go generate'
130129
131130
package {{ .PackageName }}
132131

cmd/optional/testdata/optional_bar.go

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/optional/testdata/optional_foo.go

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/optional/testdata/string.go

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

int_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestInt_MustGet_Present(t *testing.T) {
3737
func TestInt_MustGet_NotPresent(t *testing.T) {
3838
o := Int{}
3939

40-
assert.Panics(t, func(){ _ = o.MustGet() })
40+
assert.Panics(t, func() { _ = o.MustGet() })
4141
assert.False(t, o.Present())
4242
}
4343

string_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ func TestString_Get_NotPresent(t *testing.T) {
2626
assert.Equal(t, zero, v)
2727
}
2828

29-
3029
func TestString_MustGet_Present(t *testing.T) {
3130
o := NewString("foo")
3231

@@ -35,11 +34,10 @@ func TestString_MustGet_Present(t *testing.T) {
3534
assert.Equal(t, "foo", v)
3635
}
3736

38-
3937
func TestString_MustGet_NotPresent(t *testing.T) {
4038
o := String{}
4139

42-
assert.Panics(t, func(){ _ = o.MustGet() })
40+
assert.Panics(t, func() { _ = o.MustGet() })
4341
assert.False(t, o.Present())
4442
}
4543

0 commit comments

Comments
 (0)