Skip to content

Commit

Permalink
Merge pull request #4 from Valentin-Kaiser/unix-support
Browse files Browse the repository at this point in the history
[MERGE] added unix support
  • Loading branch information
Valentin-Kaiser authored Sep 29, 2022
2 parents 35547a5 + a7c29bd commit 6e1d34d
Show file tree
Hide file tree
Showing 9 changed files with 462 additions and 106 deletions.
33 changes: 25 additions & 8 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,48 @@ on:
- cron: '0 9 * * *'

jobs:
analyze:
name: Analyze
analyze-unix:
name: Analyze Unix
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'go' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
analyze-windows:
name: Analyze Windows
runs-on: windows-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
37 changes: 15 additions & 22 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,21 @@ permissions:
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
jobs:
golangci:
name: lint
golangci-unix:
name: lint unix
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout=3m
golangci-windows:
name: lint windows
runs-on: windows-latest
steps:
- uses: actions/setup-go@v3
Expand All @@ -23,25 +36,5 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0
args: --timeout=3m

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
21 changes: 0 additions & 21 deletions dbase/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"encoding/binary"
"fmt"
"math"
"syscall"
)

// Converts raw column data to the correct type for the given column
Expand Down Expand Up @@ -109,23 +108,3 @@ func (dbf *DBF) DataToValue(raw []byte, column *Column) (interface{}, error) {
return nil, fmt.Errorf("dbase-interpreter-datatovalue-9:FAILED:Unsupported column data type: %s", column.Type())
}
}

// Returns if the row at internal row pointer is deleted
func (dbf *DBF) Deleted() (bool, error) {
if dbf.table.rowPointer >= dbf.header.RowsCount {
return false, fmt.Errorf("dbase-interpreter-deleted-1:FAILED:%v", EOF)
}
_, err := syscall.Seek(syscall.Handle(*dbf.dbaseFileHandle), int64(dbf.header.FirstRow)+(int64(dbf.table.rowPointer)*int64(dbf.header.RowLength)), 0)
if err != nil {
return false, fmt.Errorf("dbase-interpreter-deleted-2:FAILED:%w", err)
}
buf := make([]byte, 1)
read, err := syscall.Read(syscall.Handle(*dbf.dbaseFileHandle), buf)
if err != nil {
return false, fmt.Errorf("dbase-interpreter-deleted-3:FAILED:%w", err)
}
if read != 1 {
return false, fmt.Errorf("dbase-interpreter-deleted-4:FAILED:%v", Incomplete)
}
return buf[0] == Deleted, nil
}
Loading

0 comments on commit 6e1d34d

Please sign in to comment.