Skip to content

Commit 3ff0c32

Browse files
docs: update README
Closes #TNTP-3736
1 parent 93a7028 commit 3ff0c32

File tree

2 files changed

+68
-3
lines changed

2 files changed

+68
-3
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,11 @@ coveralls-deps:
3333
@echo "Installing coveralls"
3434
@go get github.com/mattn/goveralls
3535
@go install github.com/mattn/goveralls
36+
37+
.PHONY: godoc_run
38+
godoc_run:
39+
godoc -http=:6060
40+
41+
.PHONY: godoc_open
42+
godoc_open:
43+
xdg-open http://localhost:6060/pkg/$(shell go list -f "{{.ImportPath}}")

README.md

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,27 @@
1010

1111
# go-option: library to work with optional types
1212

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+
1334
## Pre-generated basic optional types
1435

1536
## Gentype Utility
@@ -45,9 +66,24 @@ go install github.com/tarantool/go-option/cmd/gentypes@latest
4566
go get -tool github.com/tarantool/go-option/cmd/gentypes@latest
4667
```
4768

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
4985

50-
#### Generating Optional Types
86+
### Generating Optional Types
5187

5288
To generate optional types for existing types in a package:
5389

@@ -71,7 +107,7 @@ Flags:
71107
-128 and 127, no default value)
72108
`-verbose`: Enable verbose output (default: `false`)
73109

74-
#### Using Generated Types
110+
### Using Generated Types
75111

76112
Generated types follow the pattern Optional<TypeName> and provide methods for working
77113
with optional values:
@@ -93,6 +129,27 @@ value := opt.UnwrapOr("default")
93129
err := opt.EncodeMsgpack(encoder)
94130
```
95131

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+
96153
[godoc-badge]: https://pkg.go.dev/badge/github.com/tarantool/go-option.svg
97154
[godoc-url]: https://pkg.go.dev/github.com/tarantool/go-option
98155
[actions-badge]: https://github.com/tarantool/go-option/actions/workflows/testing.yaml/badge.svg

0 commit comments

Comments
 (0)