From 5c403a16a5b0368c52d66e8757abc91ca1dde105 Mon Sep 17 00:00:00 2001 From: Ryan Gang Date: Tue, 28 May 2024 22:02:19 +0530 Subject: [PATCH 1/2] CC-1226: Use updated RunCLI interface from tester-utils --- Makefile | 2 +- go.mod | 10 ++++++---- go.sum | 6 ++++++ internal/cli.go | 10 +--------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index ffc0bca..798933c 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ test_and_watch: test_with_sqlite: build CODECRAFTERS_SUBMISSION_DIR=$(shell pwd)/internal/test_helpers/pass_all \ - CODECRAFTERS_TEST_CASES_JSON='[{"slug":"init","tester_log_prefix":"stage-1","title":"Stage #1: Print page size"},{"slug":"table_count","tester_log_prefix":"stage-2","title":"Stage #2: Print number of tables"},{"slug":"table_names","tester_log_prefix":"stage-3","title":"Stage #3: Print table names"},{"slug":"row_counts","tester_log_prefix":"stage-4","title":"Stage #4: Count rows in a table"},{"slug":"read_single_column","tester_log_prefix":"stage-5","title":"Stage #5: Read data from a single column"},{"slug":"read_multiple_columns","tester_log_prefix":"stage-6","title":"Stage #6: Read data from multiple columns"},{"slug":"where","tester_log_prefix":"stage-7","title":"Stage #7: Filter data with a WHERE clause"},{"slug":"table_scan","tester_log_prefix":"stage-8","title":"Stage #8: Retrieve data using a full-table scan"},{"slug":"index_scan","tester_log_prefix":"stage-9","title":"Stage #9: Retrieve data using an index"}]' \ + CODECRAFTERS_TEST_CASES_JSON='[{"slug":"dr6","tester_log_prefix":"stage-1","title":"Stage #1: Print page size"},{"slug":"ce0","tester_log_prefix":"stage-2","title":"Stage #2: Print number of tables"},{"slug":"sz4","tester_log_prefix":"stage-3","title":"Stage #3: Print table names"},{"slug":"nd9","tester_log_prefix":"stage-4","title":"Stage #4: Count rows in a table"},{"slug":"az9","tester_log_prefix":"stage-5","title":"Stage #5: Read data from a single column"},{"slug":"vc9","tester_log_prefix":"stage-6","title":"Stage #6: Read data from multiple columns"},{"slug":"rf3","tester_log_prefix":"stage-7","title":"Stage #7: Filter data with a WHERE clause"},{"slug":"ws9","tester_log_prefix":"stage-8","title":"Stage #8: Retrieve data using a full-table scan"},{"slug":"nz8","tester_log_prefix":"stage-9","title":"Stage #9: Retrieve data using an index"}]' \ dist/main.out copy_course_file: diff --git a/go.mod b/go.mod index d93a881..07831fb 100644 --- a/go.mod +++ b/go.mod @@ -1,16 +1,18 @@ module github.com/codecrafters-io/sqlite-tester -go 1.20 +go 1.21 + +toolchain go1.22.1 require ( github.com/bxcodec/faker/v3 v3.6.0 - github.com/codecrafters-io/tester-utils v0.2.21 + github.com/codecrafters-io/tester-utils v0.2.24 modernc.org/sqlite v1.14.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/fatih/color v1.16.0 // indirect + github.com/fatih/color v1.17.0 // indirect github.com/google/uuid v1.3.0 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -20,7 +22,7 @@ require ( github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect github.com/stretchr/testify v1.8.4 // indirect golang.org/x/mod v0.3.0 // indirect - golang.org/x/sys v0.19.0 // indirect + golang.org/x/sys v0.20.0 // indirect golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index f3633db..2a7c34d 100644 --- a/go.sum +++ b/go.sum @@ -16,6 +16,8 @@ github.com/codecrafters-io/tester-utils v0.2.20 h1:t/IFFXOrSgRIoq6x4kUnRdjuai7Ec github.com/codecrafters-io/tester-utils v0.2.20/go.mod h1:BeSLyqBpFxUwIm41QlnuRG7ZsabBXWE2Ga3LMFUXAPM= github.com/codecrafters-io/tester-utils v0.2.21 h1:eVq/23WocZMCFnNPiB6rgP/4FZ/tlLoijT2EulkOng4= github.com/codecrafters-io/tester-utils v0.2.21/go.mod h1:BeSLyqBpFxUwIm41QlnuRG7ZsabBXWE2Ga3LMFUXAPM= +github.com/codecrafters-io/tester-utils v0.2.24 h1:8IwKd70n9BMfVqNoGxRJItFj769p6h6LxCx4OMwWoq8= +github.com/codecrafters-io/tester-utils v0.2.24/go.mod h1:VgP0WmmRsA8L1urWGMXPW4Zv5jcwHwR0LdKZ8ZAEFT4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= @@ -24,6 +26,8 @@ github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= @@ -76,6 +80,8 @@ golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/internal/cli.go b/internal/cli.go index 4cc9c00..71c9089 100644 --- a/internal/cli.go +++ b/internal/cli.go @@ -1,17 +1,9 @@ package internal import ( - "fmt" testerutils "github.com/codecrafters-io/tester-utils" ) func RunCLI(env map[string]string) int { - tester, err := testerutils.NewTester(env, testerDefinition) - - if err != nil { - fmt.Printf("%s", err) - return 1 - } - - return tester.RunCLI() + return testerutils.RunCLI(env, testerDefinition) } From 1572342c3a296efd18e3702365d073068755b4b9 Mon Sep 17 00:00:00 2001 From: Ryan Gang Date: Wed, 29 May 2024 15:14:02 +0530 Subject: [PATCH 2/2] chore: update go version to 1.21.x in ci --- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 2 +- .gitignore | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 58fd73f..ac6eebd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,7 +21,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v1 with: - go-version: 1.17.x + go-version: 1.21.x - run: "sudo apt-get install gcc-multilib g++-multilib" - name: Run GoReleaser uses: goreleaser/goreleaser-action@v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8cab9b2..f54daf2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v1 with: - go-version: 1.17.x + go-version: 1.21.x - name: Set up Python uses: actions/setup-python@v1 with: diff --git a/.gitignore b/.gitignore index ac0286c..b1654c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ dist venv + sample.db test.db internal/test.db -__pycache__ \ No newline at end of file + +__pycache__/ +.history/