Skip to content

Commit 8a6791f

Browse files
committed
Merge branch 'c-v0.18'
2 parents e5c976d + 3024d90 commit 8a6791f

14 files changed

+917
-119
lines changed

.gitlab-ci.yml

+21-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1+
stages:
2+
- gatekeeper
3+
- test
4+
15
.test:
26
stage: test
37
script:
48
- ./build/ci.sh
59

6-
test:linux:x64:old:
10+
.test:linux:x64:
711
extends: .test
812
tags: [ x64, linux, docker ]
913
image: golang:$GOVERSION
14+
15+
gatekeeper-test:
16+
extends: .test:linux:x64
17+
stage: gatekeeper
18+
variables:
19+
GOVERSION: '1.17'
20+
21+
test:linux:x64:old:
22+
extends: .test:linux:x64
1023
parallel:
1124
matrix:
1225
- GOVERSION: [ '1.11.4', '1.12' ]
@@ -15,17 +28,15 @@ test:linux:x64:old:
1528
- rm go.sum # issues with checksum mismatch, if anyone still uses old Go, they may need to delete go.sum
1629

1730
test:linux:x64:
18-
extends: .test
19-
tags: [ x64, linux, docker ]
20-
image: golang:$GOVERSION
31+
extends: .test:linux:x64
2132
parallel:
2233
matrix:
23-
- GOVERSION: [ '1.13', '1.14', '1.15', '1.16', '1.17' ]
34+
- GOVERSION: [ '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20' ]
2435

25-
test:linux:ARMv7hf:
36+
# TODO Not working on shell runner (e.g. with default (old) version): investigate and find a working setup
37+
.test:linux:ARMv7hf:
2638
extends: .test
27-
image: golang
28-
tags: [ armv7hf, linux, docker ]
39+
tags: [ armv7hf, linux, shell ]
2940
variables:
3041
BUILD_ARGS: -test.short
3142

@@ -36,10 +47,12 @@ test:linux:aarch64:
3647
BUILD_ARGS: -test.short
3748

3849
test:mac:x64:
50+
allow_failure: true # TODO Investigate and fix
3951
extends: .test
4052
tags: [ x64, mac, go ]
4153

4254
test:win:x64:
55+
allow_failure: true # TODO gcc not found
4356
extends: .test
4457
tags: [ x64, windows, go ]
4558
before_script:

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ id, err := box.Put(&Person{ FirstName: "Joe", LastName: "Green" })
3636
Want details? **[Read the docs](https://golang.objectbox.io/)** or
3737
**[check out the API reference](https://godoc.org/github.com/objectbox/objectbox-go/objectbox)**.
3838

39-
Latest release: [v1.6.1 (2022-01-27)](https://golang.objectbox.io/)
39+
Latest release: [v1.7.0 (2023-06-23)](https://golang.objectbox.io/)
4040

4141
## Table of Contents:
4242
- [High-performance Golang database](#high-performance-golang-database)

build/ci.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cd "${script_dir}/.." # move to project root dir
77

88
args="$@"
99

10-
bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-c/main/download.sh) --quiet --sync 0.15.1
10+
bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-c/main/download.sh) --quiet --sync 0.18.1
1111
export CGO_LDFLAGS="-L$(pwd -P)/lib -Wl,-rpath -Wl,$(pwd -P)/lib"
1212

1313
if [[ "$(uname)" == MINGW* ]]; then

build/test.sh

+37-6
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,44 @@ set -eu
55
script_dir=$( cd "$(dirname "$0")" ; pwd -P )
66
cd "${script_dir}/.." # move to project root dir
77

8-
unformatted_files=$(gofmt -l .)
9-
if [[ ${unformatted_files} ]]; then
10-
echo "Some files are not formatted properly. You can use \`gofmt -l -w .\` to fix them:"
11-
printf "%s\n" "${unformatted_files}"
12-
exit 1
8+
go_version=$(go version)
9+
echo $go_version
10+
if [[ $go_version == *go1.17.* ]]; then # Keep in sync with our CI gatekeeper job; TODO update to latest
11+
# gofmt is version specific, so only run this for our reference version for development
12+
echo "Reference Go version found for gofmt; checking source format..."
13+
echo "******** Testing: gofmt ********"
14+
unformatted_files=$(gofmt -l .)
15+
if [[ ${unformatted_files} ]]; then
16+
echo "Some files are not formatted properly. You can use \`gofmt -l -w .\` to fix them:"
17+
printf "%s\n" "${unformatted_files}"
18+
exit 1
19+
fi
20+
else
21+
echo "The found Go version is not our reference for gofmt; skipping source format check"
1322
fi
1423

15-
go vet ./...
24+
echo "******** Testing: go vet ********"
25+
set +e
26+
go_vet_result=$(go 2>&1 vet ./...)
27+
go_vet_rc=$?
28+
set -e
1629

30+
echo "$go_vet_result"
31+
go_vet_result_lines=$(echo "$go_vet_result" | wc -l)
32+
if [ $go_vet_rc -ne 0 ]; then
33+
if [[ $go_vet_result_lines == 2 && $go_vet_result == *objectbox/c-callbacks.go*possible\ misuse\ of\ unsafe.Pointer* ]]; then
34+
echo "Ignoring known false positive of go vet"
35+
go_vet_rc=0
36+
else
37+
echo "go vet failed ($go_vet_rc)"
38+
# Fail later because we want to run tests for now too; was: exit $go_vet_rc
39+
fi
40+
fi
41+
42+
echo "******** Testing: go test ********"
1743
go test "$@" ./...
44+
45+
if [ $go_vet_rc -ne 0 ]; then
46+
echo "go vet failed ($go_vet_rc)"
47+
exit $go_vet_rc
48+
fi

install.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ $ErrorActionPreference = "Stop"
77
# Configure supported HTTPS protocols
88
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls
99

10-
$libVersion = '0.15.1'
10+
$libVersion = '0.18.1'
1111
$libVariant = 'objectbox' # or 'objectbox-sync'
1212
$downloadDir = 'download'
1313
$extractedLibDir = "$downloadDir\objectbox-$libVersion"

install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
cLibVersion=0.15.1
4+
cLibVersion=0.18.1
55
os=$(uname)
66
cLibArgs="$*"
77

objectbox/builder.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func (builder *Builder) BuildOrError() (*ObjectBox, error) {
149149
}
150150

151151
if builder.maxSizeInKb != nil {
152-
C.obx_opt_max_db_size_in_kb(cOptions, C.size_t(*builder.maxSizeInKb))
152+
C.obx_opt_max_db_size_in_kb(cOptions, C.uint64_t(*builder.maxSizeInKb))
153153
}
154154

155155
if builder.maxReaders != nil {

objectbox/c-callbacks.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ var cCallbackMutex sync.Mutex
123123
var cCallbackMap = make(map[cCallbackId]cCallable)
124124

125125
// The result is actually not a memory pointer, just a number. That's also how it's used in cCallbackLookup().
126-
func (cbId cCallbackId) cPtrArg() C.uintptr_t {
127-
return C.uintptr_t(cbId)
126+
func (cbId cCallbackId) cPtr() unsafe.Pointer {
127+
//goland:noinspection GoVetUnsafePointer
128+
return unsafe.Pointer(uintptr(cbId))
128129
}
129130

130131
// Returns the next cCallbackId in a sequence (NOT checking its availability), skipping zero.

0 commit comments

Comments
 (0)