Skip to content

Commit 8a14686

Browse files
authored
New packages and formats (#15)
new packages and formats
1 parent 33fad82 commit 8a14686

File tree

102 files changed

+3812
-516
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+3812
-516
lines changed

.circleci/config.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ jobs:
2626
- run: make test_go
2727
- run: make imports
2828
- run: git diff --exit-code
29+
test_cli:
30+
executor: base
31+
steps:
32+
- run: sudo chown -R circleci /go/src
33+
- restore_cache:
34+
keys:
35+
- v1-go-src-{{ .Branch }}-{{ .Revision }}
36+
- run: make deps_go_test
37+
- run: make install
38+
- run: make test_cli
2939
test_javascript:
3040
executor: base
3141
steps:
@@ -45,7 +55,7 @@ jobs:
4555
- v1-go-src-{{ .Branch }}-{{ .Revision }}
4656
- run: make deps_gopherjs
4757
- run: make deps_javascript
48-
- run: npm run test:clean
58+
- run: npm run build:clean
4959
- run: make run_example_c
5060
- run: make run_example_cpp
5161
- run: make run_example_javascript
@@ -93,6 +103,9 @@ workflows:
93103
- test_go:
94104
requires:
95105
- pre_deps_golang
106+
- test_cli:
107+
requires:
108+
- pre_deps_golang
96109
- test_javascript:
97110
requires:
98111
- pre_deps_golang

Makefile

+9-1
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,26 @@ deps_javascript: ## Install dependencies for JavaScript tests
5555
# Go building, formatting, testing, and installing
5656
#
5757

58+
.PHONY: fmt
5859
fmt: ## Format Go source code
5960
go fmt $$(go list ./... )
6061

62+
.PHONY: imports
6163
imports: ## Update imports in Go source code
6264
# If missing, install goimports with: go get golang.org/x/tools/cmd/goimports
63-
goimports -w $$(find . -iname '*.go')
65+
goimports -w -local github.com/spatialcurrent/go-simple-serializer,github.com/spatialcurrent/ $$(find . -iname '*.go')
6466

67+
.PHONY: vet
6568
vet: ## Vet Go source code
6669
go vet $$(go list ./...)
6770

71+
.PHONY: test_go
6872
test_go: ## Run Go tests
6973
bash scripts/test.sh
74+
75+
.PHONY: test_cli
76+
test_cli: ## Run CLI tests
77+
bash scripts/test-cli.sh
7078

7179
build: build_cli build_javascript build_so build_android ## Build CLI, Shared Objects (.so), JavaScript, and Android
7280

README.md

+13-37
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,23 @@
44

55
# Description
66

7-
**go-simple-serializer** (aka GSS) is a simple library for serializing/deserializing objects that aims to decrease the burden on developers to support multiple serialization formats in their applications. GSS supports a variety of operating systems, architectures, and use cases. A CLI is released for Microsoft Windows, Linux distributions, and [Darwin](https://en.wikipedia.org/wiki/Darwin_%28operating_system%29) platforms.
7+
**go-simple-serializer** (aka GSS) is a simple library to easily convert data between formats that aims to decrease the burden on developers to support multiple serialization formats in their applications. GSS supports a variety of operating systems, architectures, and use cases. A CLI is released for Microsoft Windows, Linux distributions, and [Darwin](https://en.wikipedia.org/wiki/Darwin_%28operating_system%29) platforms.
88

99
Using cross compilers, this library can also be called by other languages, including `C`, `C++`, `Python`, and `JavaScript`. This library is cross compiled into a Shared Object file (`*.so`), which can be called by `C`, `C++`, and `Python` on Linux machines. This library is also compiled to pure `JavaScript` using [GopherJS](https://github.com/gopherjs/gopherjs), which can be called by [Node.js](https://nodejs.org) and loaded in the browser. See the examples folder for patterns that you can use.
1010

1111
**Formats**
1212

13-
GSS supports the following formats.
14-
15-
| Format | Description |
16-
| ---- | ------ |
17-
| bson | [Binary JSON](https://en.wikipedia.org/wiki/BSON) |
18-
| csv | [Comma-Separated Values](https://en.wikipedia.org/wiki/Comma-separated_values) |
19-
| hcl | HashiCorp Configuration Language |
20-
| hcl2 | HashiCorp Configuration Language (version 2.x) |
21-
| json | [JSON](http://json.org/) |
22-
| jsonl | [JSON Lines](http://jsonlines.org/) |
23-
| properties | [Properties](https://en.wikipedia.org/wiki/.properties) |
24-
| tags | single-line key=value tags |
25-
| toml | [TOML](https://github.com/toml-lang/toml) |
26-
| tsv | Tab-Separated Values |
27-
| yaml | [YAML](https://yaml.org/) |
28-
29-
`hcl` and `hcl2` implementation is fragile and very much in `alpha`. The other formats are well-supported.
13+
GSS supports many common formats, including CSV, JSON, and YAML. Pull requests to support other formats are welcome! See the [Formats.md](docs/Formats.md) document for a full list of supported formats.
3014

3115
**Packages**
3216

33-
The main public api for GSS is in the `gss` package. However, this library does ship with lower-level packages that can be imported directly as well.
34-
35-
| Package | Purpose |
36-
| ---- | ------ |
37-
| bson | Binary JSON |
38-
| escaper | Escape/unescape strings |
39-
| gss | The main public API |
40-
| inspector | Reusable functions for inspecting objects |
41-
| iterator | Wrapper for iterable formats |
42-
| json | JSON |
43-
| jsonl | JSON Lines |
44-
| properties | Properties Files |
45-
| scanner | Scanning through a stream of bytes |
46-
| splitter | Creating custom bufio.SplitFunc |
47-
| sv | Separated-Values formats, i.e., CSV and TSV. |
48-
| toml | TOML |
49-
| yaml | YAML |
17+
The main public api for GSS is in the `gss` package. However, this library does ship with internal packages under `/pkg/...` that can be imported and used directly.
5018

5119
# Usage
5220

5321
**CLI**
5422

55-
The command line tool, `gss`, can be used to easily covert data between formats. We currently support the following platforms.
23+
The command line tool, `gss`, can be used to easily convert data between formats. We currently support the following platforms.
5624

5725
| GOOS | GOARCH |
5826
| ---- | ------ |
@@ -61,7 +29,7 @@ The command line tool, `gss`, can be used to easily covert data between formats.
6129
| windows | amd64 |
6230
| linux | arm64 |
6331

64-
Pull requests to support other platforms are welcome! See the [examples](#examples) section below for usage.
32+
Pull requests to support other platforms are welcome! See the [CLI.md](docs/CLI.md) document for detailed usage and examples.
6533

6634
**Go**
6735

@@ -196,6 +164,14 @@ The default destination for build artifacts is `go-simple-serializer/bin`, but y
196164

197165
# Testing
198166

167+
**CLI**
168+
169+
To run CLI testes use `make test_cli`, which uses [shUnit2](https://github.com/kward/shunit2). If you recive a `shunit2:FATAL Please declare TMPDIR with path on partition with exec permission.` error, you can modify the `TMPDIR` environment variable in line or with `export TMPDIR=<YOUR TEMP DIRECTORY HERE>`. For example:
170+
171+
```
172+
TMPDIR="/usr/local/tmp" make test_cli
173+
```
174+
199175
**Go**
200176

201177
To run Go tests use `make test_go` (or `bash scripts/test.sh`), which runs unit tests, `go vet`, `go vet with shadow`, [errcheck](https://github.com/kisielk/errcheck), [ineffassign](https://github.com/gordonklaus/ineffassign), [staticcheck](https://staticcheck.io/), and [misspell](https://github.com/client9/misspell).

cmd/gss.global.js/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ package main
4040

4141
import (
4242
"github.com/gopherjs/gopherjs/js"
43+
4344
"github.com/spatialcurrent/go-simple-serializer/pkg/gssjs"
4445
)
4546

cmd/gss.mod.js/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ package main
3737

3838
import (
3939
"github.com/gopherjs/gopherjs/js"
40+
4041
"github.com/spatialcurrent/go-simple-serializer/pkg/gssjs"
4142
)
4243

0 commit comments

Comments
 (0)