diff options
-rw-r--r-- | .codecov.yml | 4 | ||||
-rw-r--r-- | .github/FUNDING.yml | 8 | ||||
-rw-r--r-- | .github/workflows/cifuzz.yaml | 29 | ||||
-rw-r--r-- | .github/workflows/docker.yaml | 21 | ||||
-rw-r--r-- | .github/workflows/go.yaml | 115 | ||||
-rw-r--r-- | LICENSE | 21 | ||||
-rw-r--r-- | upgrade/go.mod | 5 | ||||
-rw-r--r-- | upgrade/go.sum | 12 | ||||
-rw-r--r-- | upgrade/package.go | 5 | ||||
-rw-r--r-- | upgrade/upgrade.go | 231 |
10 files changed, 0 insertions, 451 deletions
diff --git a/.codecov.yml b/.codecov.yml deleted file mode 100644 index 35cde5c..0000000 --- a/.codecov.yml +++ /dev/null @@ -1,4 +0,0 @@ -coverage: - status: - project: off - patch: off diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 8f80494..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,8 +0,0 @@ -# These are supported funding model platforms - -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: mattn # Replace with a single Patreon username -open_collective: mattn # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -custom: # Replace with a single custom sponsorship URL diff --git a/.github/workflows/cifuzz.yaml b/.github/workflows/cifuzz.yaml deleted file mode 100644 index e198c52..0000000 --- a/.github/workflows/cifuzz.yaml +++ /dev/null @@ -1,29 +0,0 @@ -name: CIFuzz -on: [pull_request] -jobs: - Fuzzing: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - sanitizer: [address] - steps: - - name: Build Fuzzers (${{ matrix.sanitizer }}) - uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master - with: - oss-fuzz-project-name: 'go-sqlite3' - dry-run: false - sanitizer: ${{ matrix.sanitizer }} - - name: Run Fuzzers (${{ matrix.sanitizer }}) - uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master - with: - oss-fuzz-project-name: 'go-sqlite3' - fuzz-seconds: 600 - dry-run: false - sanitizer: ${{ matrix.sanitizer }} - - name: Upload Crash - uses: actions/upload-artifact@v1 - if: failure() - with: - name: ${{ matrix.sanitizer }}-artifacts - path: ./out/artifacts diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml deleted file mode 100644 index 7983de4..0000000 --- a/.github/workflows/docker.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: dockerfile - -on: - workflow_dispatch: - push: - tags: - - 'v*' - pull_request: - branches: [ master ] - -jobs: - dockerfile: - name: Run Dockerfiles in examples - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Run example - simple - run: | - docker build -t simple -f ./_example/simple/Dockerfile . - docker run simple | grep 99\ こんにちは世界099 diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml deleted file mode 100644 index c96bf31..0000000 --- a/.github/workflows/go.yaml +++ /dev/null @@ -1,115 +0,0 @@ -name: Go - -on: [push, pull_request] - -jobs: - - test: - name: Test - runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash - - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - go: ['1.19', '1.20', '1.21'] - fail-fast: false - env: - OS: ${{ matrix.os }} - GO: ${{ matrix.go }} - steps: - - if: startsWith(matrix.os, 'macos') - run: brew update - - - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go }} - - - name: Get Build Tools - run: | - GO111MODULE=on go install github.com/ory/go-acc@latest - - - name: Add $GOPATH/bin to $PATH - run: | - echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" - - - uses: actions/checkout@v2 - - - name: 'Tags: default' - run: go-acc . -- -race -v -tags "" - - - name: 'Tags: libsqlite3' - run: go-acc . -- -race -v -tags "libsqlite3" - - - name: 'Tags: full' - run: go-acc . -- -race -v -tags "sqlite_allow_uri_authority sqlite_app_armor sqlite_column_metadata sqlite_foreign_keys sqlite_fts5 sqlite_icu sqlite_introspect sqlite_json sqlite_math_functions sqlite_os_trace sqlite_preupdate_hook sqlite_secure_delete sqlite_see sqlite_stat4 sqlite_trace sqlite_unlock_notify sqlite_userauth sqlite_vacuum_incr sqlite_vtable" - - - name: 'Tags: vacuum' - run: go-acc . -- -race -v -tags "sqlite_vacuum_full" - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 - with: - env_vars: OS,GO - file: coverage.txt - - test-windows: - name: Test for Windows - runs-on: windows-latest - defaults: - run: - shell: bash - - strategy: - matrix: - go: ['1.19', '1.20', '1.21'] - fail-fast: false - env: - OS: windows-latest - GO: ${{ matrix.go }} - steps: - - uses: msys2/setup-msys2@v2 - with: - update: true - install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-sqlite3 - msystem: MINGW64 - path-type: inherit - - - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go }} - - - name: Add $GOPATH/bin to $PATH - run: | - echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" - shell: msys2 {0} - - - uses: actions/checkout@v2 - - - name: 'Tags: default' - run: go build -race -v -tags "" - shell: msys2 {0} - - - name: 'Tags: libsqlite3' - run: go build -race -v -tags "libsqlite3" - shell: msys2 {0} - - - name: 'Tags: full' - run: | - echo 'skip this test' - echo go build -race -v -tags "sqlite_allow_uri_authority sqlite_app_armor sqlite_column_metadata sqlite_foreign_keys sqlite_fts5 sqlite_icu sqlite_introspect sqlite_json sqlite_math_functions sqlite_preupdate_hook sqlite_secure_delete sqlite_see sqlite_stat4 sqlite_trace sqlite_unlock_notify sqlite_userauth sqlite_vacuum_incr sqlite_vtable" - shell: msys2 {0} - - - name: 'Tags: vacuum' - run: go build -race -v -tags "sqlite_vacuum_full" - shell: msys2 {0} - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 - with: - env_vars: OS,GO - file: coverage.txt - -# based on: github.com/koron-go/_skeleton/.github/workflows/go.yml diff --git a/LICENSE b/LICENSE deleted file mode 100644 index ca458bb..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Yasuhiro Matsumoto - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/upgrade/go.mod b/upgrade/go.mod deleted file mode 100644 index 1413ffa..0000000 --- a/upgrade/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/mattn/go-sqlite3/upgrade - -go 1.19 - -require github.com/PuerkitoBio/goquery v1.7.1 // indirect diff --git a/upgrade/go.sum b/upgrade/go.sum deleted file mode 100644 index 986201f..0000000 --- a/upgrade/go.sum +++ /dev/null @@ -1,12 +0,0 @@ -github.com/PuerkitoBio/goquery v1.7.1 h1:oE+T06D+1T7LNrn91B4aERsRIeCLJ/oPSa6xB9FPnz4= -github.com/PuerkitoBio/goquery v1.7.1/go.mod h1:XY0pP4kfraEmmV1O7Uf6XyjoslwsneBbgeDjLYuN8xY= -github.com/andybalholm/cascadia v1.2.0 h1:vuRCkM5Ozh/BfmsaTm26kbjm0mIOM3yS5Ek/F5h18aE= -github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxBp0T0eFw1RUQY= -golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= -golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/upgrade/package.go b/upgrade/package.go deleted file mode 100644 index 895bc73..0000000 --- a/upgrade/package.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package upgrade is a dummy package to ensure package can be loaded -// -// This file is to avoid the following error: -// can't load package: package go-sqlite3/upgrade: build constraints exclude all Go files in go-sqlite3\upgrade -package upgrade diff --git a/upgrade/upgrade.go b/upgrade/upgrade.go deleted file mode 100644 index 9652c67..0000000 --- a/upgrade/upgrade.go +++ /dev/null @@ -1,231 +0,0 @@ -//go:build !cgo && upgrade && ignore -// +build !cgo,upgrade,ignore - -package main - -import ( - "archive/zip" - "bufio" - "bytes" - "fmt" - "io" - "io/ioutil" - "log" - "net/http" - "os" - "path" - "path/filepath" - "strings" - "time" - - "github.com/PuerkitoBio/goquery" -) - -func download(prefix string) (url string, content []byte, err error) { - year := time.Now().Year() - - site := "https://www.sqlite.org/download.html" - //fmt.Printf("scraping %v\n", site) - doc, err := goquery.NewDocument(site) - if err != nil { - log.Fatal(err) - } - - doc.Find("a").Each(func(_ int, s *goquery.Selection) { - if strings.HasPrefix(s.Text(), prefix) { - url = fmt.Sprintf("https://www.sqlite.org/%d/", year) + s.Text() - } - }) - - if url == "" { - return "", nil, fmt.Errorf("Unable to find prefix '%s' on sqlite.org", prefix) - } - - fmt.Printf("Downloading %v\n", url) - resp, err := http.Get(url) - if err != nil { - log.Fatal(err) - } - - // Ready Body Content - content, err = ioutil.ReadAll(resp.Body) - defer resp.Body.Close() - if err != nil { - return "", nil, err - } - - return url, content, nil -} - -func mergeFile(src string, dst string) error { - defer func() error { - fmt.Printf("Removing: %s\n", src) - err := os.Remove(src) - - if err != nil { - return err - } - - return nil - }() - - // Open destination - fdst, err := os.OpenFile(dst, os.O_APPEND|os.O_WRONLY, 0666) - if err != nil { - return err - } - defer fdst.Close() - - // Read source content - content, err := ioutil.ReadFile(src) - if err != nil { - return err - } - - // Add Additional newline - if _, err := fdst.WriteString("\n"); err != nil { - return err - } - - fmt.Printf("Merging: %s into %s\n", src, dst) - if _, err = fdst.Write(content); err != nil { - return err - } - - return nil -} - -func main() { - fmt.Println("Go-SQLite3 Upgrade Tool") - - wd, err := os.Getwd() - if err != nil { - log.Fatal(err) - } - if filepath.Base(wd) != "upgrade" { - log.Printf("Current directory is %q but should run in upgrade directory", wd) - os.Exit(1) - } - - // Download Amalgamation - _, amalgamation, err := download("sqlite-amalgamation-") - if err != nil { - log.Fatalf("Failed to download: sqlite-amalgamation; %s", err) - } - - // Download Source - _, source, err := download("sqlite-src-") - if err != nil { - log.Fatalf("Failed to download: sqlite-src; %s", err) - } - - // Create Amalgamation Zip Reader - rAmalgamation, err := zip.NewReader(bytes.NewReader(amalgamation), int64(len(amalgamation))) - if err != nil { - log.Fatal(err) - } - - // Create Source Zip Reader - rSource, err := zip.NewReader(bytes.NewReader(source), int64(len(source))) - if err != nil { - log.Fatal(err) - } - - // Extract Amalgamation - for _, zf := range rAmalgamation.File { - var f *os.File - switch path.Base(zf.Name) { - case "sqlite3.c": - f, err = os.Create("../sqlite3-binding.c") - case "sqlite3.h": - f, err = os.Create("../sqlite3-binding.h") - case "sqlite3ext.h": - f, err = os.Create("../sqlite3ext.h") - default: - continue - } - if err != nil { - log.Fatal(err) - } - zr, err := zf.Open() - if err != nil { - log.Fatal(err) - } - - _, err = io.WriteString(f, "#ifndef USE_LIBSQLITE3\n") - if err != nil { - zr.Close() - f.Close() - log.Fatal(err) - } - scanner := bufio.NewScanner(zr) - for scanner.Scan() { - text := scanner.Text() - if text == `#include "sqlite3.h"` { - text = `#include "sqlite3-binding.h" -#ifdef __clang__ -#define assert(condition) ((void)0) -#endif -` - } - _, err = fmt.Fprintln(f, text) - if err != nil { - break - } - } - err = scanner.Err() - if err != nil { - zr.Close() - f.Close() - log.Fatal(err) - } - _, err = io.WriteString(f, "#else // USE_LIBSQLITE3\n // If users really want to link against the system sqlite3 we\n// need to make this file a noop.\n #endif") - if err != nil { - zr.Close() - f.Close() - log.Fatal(err) - } - zr.Close() - f.Close() - fmt.Printf("Extracted: %v\n", filepath.Base(f.Name())) - } - - //Extract Source - for _, zf := range rSource.File { - var f *os.File - switch path.Base(zf.Name) { - case "userauth.c": - f, err = os.Create("../userauth.c") - case "sqlite3userauth.h": - f, err = os.Create("../userauth.h") - default: - continue - } - if err != nil { - log.Fatal(err) - } - zr, err := zf.Open() - if err != nil { - log.Fatal(err) - } - - _, err = io.Copy(f, zr) - if err != nil { - log.Fatal(err) - } - - zr.Close() - f.Close() - fmt.Printf("extracted %v\n", filepath.Base(f.Name())) - } - - // Merge SQLite User Authentication into amalgamation - if err := mergeFile("../userauth.c", "../sqlite3-binding.c"); err != nil { - log.Fatal(err) - } - if err := mergeFile("../userauth.h", "../sqlite3-binding.h"); err != nil { - log.Fatal(err) - } - - os.Exit(0) -} |