10
10
11
11
# go-option: library to work with optional types
12
12
13
+ Package ` option ` implements effective and useful instruments to work
14
+ with optional types in Go. It eliminates code doubling and provides
15
+ high performance due to:
16
+ - no memory allocations
17
+ - serialization without reflection (at least for pre-generated types)
18
+ - support for basic and custom types
19
+
20
+ ## Table of contents
21
+
22
+ * [ Pre-generated basic optional types] ( #pre-generated-basic-optional-types )
23
+ * [ Gentype Utility] ( #gentype-utility )
24
+ * [ Overview] ( #overview )
25
+ * [ Features] ( #features )
26
+ * [ Installation] ( #installation )
27
+ * [ Documentation] ( #documentation )
28
+ * [ Quick start] ( #quick-start )
29
+ * [ Generating Optional Types] ( #generating-optional-types )
30
+ * [ Using Generated Types] ( #using-generated-types )
31
+ * [ Run tests] ( #run-tests )
32
+ * [ Development] ( #development )
33
+
13
34
## Pre-generated basic optional types
14
35
15
36
## Gentype Utility
@@ -45,9 +66,24 @@ go install github.com/tarantool/go-option/cmd/gentypes@latest
45
66
go get -tool github.com/tarantool/go-option/cmd/gentypes@latest
46
67
```
47
68
48
- ### Usage
69
+ ## Documentation
70
+
71
+ You could run the ` godoc ` server on ` localhost:6060 ` with the command:
72
+
73
+ ``` shell
74
+ make godoc_run
75
+ ```
76
+
77
+ And open the generated documentation in another terminal or use the
78
+ [ link] [ godoc-url ] :
79
+
80
+ ``` shell
81
+ make godoc_open
82
+ ```
83
+
84
+ ## Quick start
49
85
50
- #### Generating Optional Types
86
+ ### Generating Optional Types
51
87
52
88
To generate optional types for existing types in a package:
53
89
@@ -71,7 +107,7 @@ Flags:
71
107
-128 and 127, no default value)
72
108
• ` -verbose ` : Enable verbose output (default: ` false ` )
73
109
74
- #### Using Generated Types
110
+ ### Using Generated Types
75
111
76
112
Generated types follow the pattern Optional<TypeName > and provide methods for working
77
113
with optional values:
@@ -93,6 +129,27 @@ value := opt.UnwrapOr("default")
93
129
err := opt.EncodeMsgpack (encoder)
94
130
```
95
131
132
+ ## Run tests
133
+
134
+ To run default set of tests:
135
+
136
+ ``` shell
137
+ go test ./... -count=1
138
+ ```
139
+
140
+ ## Development
141
+
142
+ You could use our Makefile targets:
143
+
144
+ ``` shell
145
+ make codespell
146
+ make test
147
+ make testrace
148
+ make coveralls-deps
149
+ make coveralls
150
+ make coverage
151
+ ```
152
+
96
153
[ godoc-badge ] : https://pkg.go.dev/badge/github.com/tarantool/go-option.svg
97
154
[ godoc-url ] : https://pkg.go.dev/github.com/tarantool/go-option
98
155
[ actions-badge ] : https://github.com/tarantool/go-option/actions/workflows/testing.yaml/badge.svg
0 commit comments