Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"version": "latest",
"moby": false // go for the upstream Docker-CE
},
"ghcr.io/thediveo/devcontainer-features/lazygit:0": {},
"ghcr.io/thediveo/devcontainer-features/local-pkgsite:0": {},
"ghcr.io/thediveo/devcontainer-features/goreportcard:0": {},
"ghcr.io/thediveo/devcontainer-features/go-mod-upgrade:0": {},
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/buildandtest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:

steps:
- name: Set up Go ${{matrix.go}}
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # pin@v4
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version: ${{matrix.go}}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # pin@v3
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

- name: Test Go packages
run: go test -run IEDData -v -p 1 -race -exec sudo ./...
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # pin@v3
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

- name: Initialize CodeQL
uses: github/codeql-action/init@83f0fe6c4988d98a455712a27f0255212bba9bd4 # pin@v2
uses: github/codeql-action/init@b8d3b6e8af63cde30bdc382c0bc28114f4346c88 # v2
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@83f0fe6c4988d98a455712a27f0255212bba9bd4 # pin@v2
uses: github/codeql-action/autobuild@b8d3b6e8af63cde30bdc382c0bc28114f4346c88 # v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@83f0fe6c4988d98a455712a27f0255212bba9bd4 # pin@v2
uses: github/codeql-action/analyze@b8d3b6e8af63cde30bdc382c0bc28114f4346c88 # v2
29 changes: 29 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: "2"
linters:
enable:
# https://golangci-lint.run/usage/linters/#enabled-by-default
- errcheck
- govet
- ineffassign
- staticcheck
- unused

- ginkgolinter
- gocheckcompilerdirectives
- godoclint
- modernize
- nolintlint
formatters:
enable:
- gci
- gofmt
settings:
# https://golangci-lint.run/docs/formatters/configuration/#gci
gci:
sections:
- standard
- default
- localmodule
- prefix(github.com/onsi)
- dot
custom-order: true
27 changes: 27 additions & 0 deletions .vscode/markdown-preview.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
:root {
--mono-font: Consolas,'Roboto Mono','Lucida Sans','Courier','Courier New', monospace;
}

code, pre {
font-family: var(--mono-font);
}

body.vscode-light {
code, pre {
color: inherit;
background-color: rgba(0, 0, 0, 0.05);
}
span.hljs-attr { color: darkgreen; }
span.hljs-keyword { color: darkblue; }
}

body.vscode-dark {
code {
color: inherit;
background-color: rgba(255, 255, 255, 0.05);
}
span.hljs-attr { color: lightgreen; }
span.hljs-keyword { color: lightsteelblue; }
}

code.code-line { background-color: transparent !important; }
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

[![PkgGoDev](https://pkg.go.dev/badge/github.com/siemens/ieddata)](https://pkg.go.dev/github.com/siemens/ieddata)
[![GitHub](https://img.shields.io/github/license/siemens/ieddata)](https://img.shields.io/github/license/siemens/ieddata)
![build and test](https://github.com/siemens/ieddata//actions/workflows/buildandtest.yaml/badge.svg?branch=main)
![build and test](https://github.com/siemens/ieddata/actions/workflows/buildandtest.yaml/badge.svg?branch=main)
![goroutines](https://img.shields.io/badge/go%20routines-not%20leaking-success)
![file descriptors](https://img.shields.io/badge/file%20descriptors-not%20leaking-success)
[![Go Report Card](https://goreportcard.com/badge/github.com/siemens/ieddata)](https://goreportcard.com/report/github.com/siemens/ieddata)
![Coverage](https://img.shields.io/badge/Coverage-88.7%25-brightgreen)
![Coverage](https://img.shields.io/badge/Coverage-89.0%25-brightgreen)

`iedata` provides querying information about a Siemens Industrial Edge (virtual)
device from an app inside the IE(v)D.
Expand Down
2 changes: 1 addition & 1 deletion apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (db *AppEngineDB) Apps() ([]App, error) {
if err != nil {
return nil, err
}
defer rows.Close()
defer func() { _ = rows.Close() }()

// Work around cznic/sqlite not fully supporting sqlx for the moment. For
// this, we need to map the query result column to their App struct fields.
Expand Down
2 changes: 1 addition & 1 deletion apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = Describe("IED app engine installed apps", func() {
// core running.
cwd := Successful(os.Getwd())
db := Successful(open(path.Join(cwd, "tests/sqlite-alpine-appengine-db/test-apps-and-device.db"), model.PIDType(os.Getpid())))
defer db.Close()
defer func() { _ = db.Close() }()

apps := Successful(db.Apps())
Expect(apps).To(HaveLen(4))
Expand Down
2 changes: 1 addition & 1 deletion core.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"errors"

"github.com/thediveo/lxkns/model"
"github.com/thediveo/whalewatcher/watcher/moby"
"github.com/thediveo/whalewatcher/v2/watcher/moby"
)

// EdgeIotCoreContainerName is the name of the IED runtime container.
Expand Down
15 changes: 13 additions & 2 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import (
"github.com/jmoiron/sqlx"
"github.com/thediveo/lxkns/model"
"github.com/thediveo/procfsroot"

// _ "github.com/mattn/go-sqlite3" // pull in "sqlite3" driver
_ "modernc.org/sqlite"
)

Expand Down Expand Up @@ -114,6 +112,19 @@ func open(name string, pid model.PIDType) (*AppEngineDB, error) {
return nil, fmt.Errorf("unable to open database, reason: %w", err)
}

// When available, make a copy of the accompanying WAL file also.
if walf, err := os.Open(dbpath + "-wal"); err == nil {
defer func() { _ = walf.Close() }()
if tmpwalf, err := os.Create(tmpdbf.Name() + "-wal"); err == nil {
defer func() { _ = tmpwalf.Close() }()
if _, err := io.Copy(tmpwalf, walf); err != nil {
_ = os.Remove(tmpwalf.Name())
}
_ = tmpwalf.Close()
}
_ = walf.Close()
}

// As sql.Open might just "validate its parameters" and this might mean near
// to nothing, we explicitly ping the database in order to see that it is
// okay.
Expand Down
2 changes: 1 addition & 1 deletion device.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func (db *AppEngineDB) DeviceInfo() (map[string]string, error) {
if err != nil {
return nil, err
}
defer rows.Close()
defer func() { _ = rows.Close() }()
devinfo := map[string]string{}
for rows.Next() {
var key, value string
Expand Down
2 changes: 1 addition & 1 deletion example_apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func Example_listInstalledApps() {
if err != nil {
panic(err)
}
defer db.Close()
defer func() { _ = db.Close() }()

apps, err := db.Apps()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion example_iedinfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func Example_showDeviceInfo() {
if err != nil {
panic(err)
}
defer db.Close()
defer func() { _ = db.Close() }()

di, err := db.DeviceInfo()
if err != nil {
Expand Down
112 changes: 73 additions & 39 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,77 +1,111 @@
module github.com/siemens/ieddata

go 1.24.0

toolchain go1.24.4
go 1.26.2

require (
github.com/jmoiron/sqlx v1.4.0
github.com/onsi/ginkgo/v2 v2.23.4
github.com/onsi/gomega v1.37.0
github.com/onsi/ginkgo/v2 v2.28.2
github.com/onsi/gomega v1.39.1
github.com/thediveo/fdooze v0.3.2
github.com/thediveo/lxkns v0.38.1
github.com/thediveo/morbyd v0.18.0
github.com/thediveo/lxkns v0.45.1
github.com/thediveo/morbyd/v2 v2.0.0
github.com/thediveo/procfsroot v1.0.2
github.com/thediveo/success v1.0.3
github.com/thediveo/whalewatcher v0.12.0
golang.org/x/sys v0.34.0
modernc.org/sqlite v1.38.0
github.com/thediveo/whalewatcher/v2 v2.0.0
golang.org/x/sys v0.43.0
modernc.org/sqlite v1.50.0
)

require (
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
github.com/Masterminds/semver/v3 v3.4.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/console v1.0.5 // indirect
github.com/containerd/containerd/api v1.10.0 // indirect
github.com/containerd/containerd/v2 v2.2.3 // indirect
github.com/containerd/continuity v0.4.5 // indirect
github.com/containerd/errdefs v1.0.0 // indirect
github.com/containerd/errdefs/pkg v0.3.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/containerd/platforms v1.0.0-rc.4 // indirect
github.com/containerd/ttrpc v1.2.8 // indirect
github.com/containerd/typeurl/v2 v2.2.3 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/docker v28.3.1+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-connections v0.7.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gofrs/flock v0.13.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 // indirect
github.com/in-toto/attestation v1.1.2 // indirect
github.com/in-toto/in-toto-golang v0.10.0 // indirect
github.com/klauspost/compress v1.18.5 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/moby/buildkit v0.29.0 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/go-archive v0.1.0 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/go-archive v0.2.0 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/moby/api v1.54.2 // indirect
github.com/moby/moby/client v0.4.1 // indirect
github.com/moby/patternmatcher v0.6.1 // indirect
github.com/moby/sys/sequential v0.6.0 // indirect
github.com/moby/sys/signal v0.7.1 // indirect
github.com/moby/sys/user v0.4.0 // indirect
github.com/moby/sys/userns v0.1.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/moby/term v0.5.2 // indirect
github.com/morikuni/aec v1.1.0 // indirect
github.com/ncruces/go-strftime v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/thediveo/cpus v0.7.1 // indirect
github.com/thediveo/faf v0.2.0 // indirect
github.com/thediveo/go-mntinfo v1.0.3 // indirect
github.com/secure-systems-lab/go-securesystemslib v0.10.0 // indirect
github.com/shibumi/go-pathspec v1.3.0 // indirect
github.com/sirupsen/logrus v1.9.4 // indirect
github.com/thediveo/cpus v0.11.0 // indirect
github.com/thediveo/faf v0.2.2 // indirect
github.com/thediveo/go-mntinfo v1.0.4 // indirect
github.com/thediveo/ioctl v0.9.4 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
go.opentelemetry.io/otel v1.35.0 // indirect
go.opentelemetry.io/otel/metric v1.35.0 // indirect
go.opentelemetry.io/otel/trace v1.35.0 // indirect
go.opentelemetry.io/proto/otlp v1.7.0 // indirect
go.uber.org/automaxprocs v1.6.0 // indirect
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/text v0.26.0 // indirect
golang.org/x/tools v0.34.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
modernc.org/libc v1.65.10 // indirect
github.com/tonistiigi/fsutil v0.0.0-20251211185533-a2aa163d723f // indirect
github.com/tonistiigi/go-csvvalue v0.0.0-20240814133006-030d3b2625d0 // indirect
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect
github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
go.opentelemetry.io/otel v1.43.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 // indirect
go.opentelemetry.io/otel/metric v1.43.0 // indirect
go.opentelemetry.io/otel/sdk v1.43.0 // indirect
go.opentelemetry.io/otel/trace v1.43.0 // indirect
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.50.0 // indirect
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f // indirect
golang.org/x/mod v0.35.0 // indirect
golang.org/x/net v0.53.0 // indirect
golang.org/x/sync v0.20.0 // indirect
golang.org/x/text v0.36.0 // indirect
golang.org/x/time v0.14.0 // indirect
golang.org/x/tools v0.44.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260427160629-7cedc36a6bc4 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260420184626-e10c466a9529 // indirect
google.golang.org/grpc v1.80.0 // indirect
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect
modernc.org/libc v1.72.0 // indirect
modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.11.0 // indirect
)
Loading
Loading