From 6b1bcae924a21bba7438502acf0f952efd895706 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Wed, 20 Sep 2023 08:50:01 -0600 Subject: [PATCH] GH-37779: [Go] Link to the pkg.go.dev site for Go reference docs (#37780) ### Rationale for this change This change updates the Go `README.md` to point to the latest version of the reference documentation. ### What changes are included in this PR? The Go `README.md` has been updated with a badge that points to [the v14 version](https://pkg.go.dev/github.com/apache/arrow/go/v14) of the docs. In addition, the `dev/release/utils-prepare.sh` script has been modified so that the link in the Go `README.md` will be updated when the release version changes. ### Are these changes tested? I tried running `PREPARE_CHANGELOG=0 ./dev/release/01-prepare.sh 14 15 1`, but I don't have `mvn` installed, so was not able to fully validate the changes. In the `go` directory, I ran the following and confirmed that the changes looked like what I would expect: ```shell find . "(" -name "*.go*" -o -name "go.mod" -o -name README.md ")" -exec sed -i.bak -E -e \ "s|(github\\.com/apache/arrow/go)/v[0-9]+|\1/v15|g" {} \; ``` ### Are there any user-facing changes? Documentation changes only. * Closes: #37779 Lead-authored-by: Tim Schaub Co-authored-by: Sutou Kouhei Signed-off-by: Matt Topol --- dev/release/post-11-bump-versions-test.rb | 35 +++++++++++++++------- dev/release/utils-prepare.sh | 4 +-- go/README.md | 2 +- go/arrow/flight/flightsql/driver/README.md | 6 ++-- 4 files changed, 31 insertions(+), 16 deletions(-) diff --git a/dev/release/post-11-bump-versions-test.rb b/dev/release/post-11-bump-versions-test.rb index 79d17e84eb7cb..0ef4646236740 100644 --- a/dev/release/post-11-bump-versions-test.rb +++ b/dev/release/post-11-bump-versions-test.rb @@ -235,7 +235,7 @@ def test_version_post_tag ] end - Dir.glob("go/**/{go.mod,*.go,*.go.*}") do |path| + Dir.glob("go/**/{go.mod,*.go,*.go.*,README.md}") do |path| if path == "go/arrow/doc.go" expected_changes << { path: path, @@ -253,19 +253,34 @@ def test_version_post_tag hunks = [] if release_type == :major lines = File.readlines(path, chomp: true) - target_lines = lines.grep(/#{Regexp.escape(import_path)}/) + target_lines = lines.each_with_index.select do |line, i| + line.include?(import_path) + end next if target_lines.empty? - hunk = [] - target_lines.each do |line| - hunk << "-#{line}" + n_context_lines = 3 # The default of Git's diff.context + target_hunks = [[target_lines.first[0]]] + previous_i = target_lines.first[1] + target_lines[1..-1].each do |line, i| + if i - previous_i < n_context_lines + target_hunks.last << line + else + target_hunks << [line] + end + previous_i = i end - target_lines.each do |line| - new_line = line.gsub("v#{@snapshot_major_version}") do - "v#{@next_major_version}" + target_hunks.each do |lines| + hunk = [] + lines.each do |line,| + hunk << "-#{line}" + end + lines.each do |line| + new_line = line.gsub("v#{@snapshot_major_version}") do + "v#{@next_major_version}" + end + hunk << "+#{new_line}" end - hunk << "+#{new_line}" + hunks << hunk end - hunks << hunk end if path == "go/parquet/writer_properties.go" hunks << [ diff --git a/dev/release/utils-prepare.sh b/dev/release/utils-prepare.sh index ceb51812c11ae..464702b811d8b 100644 --- a/dev/release/utils-prepare.sh +++ b/dev/release/utils-prepare.sh @@ -155,8 +155,8 @@ update_versions() { popd pushd "${ARROW_DIR}/go" - find . "(" -name "*.go*" -o -name "go.mod" ")" -exec sed -i.bak -E -e \ - "s|(github\\.com/apache/arrow/go)/v[0-9]+|\1/v${major_version}|" {} \; + find . "(" -name "*.go*" -o -name "go.mod" -o -name README.md ")" -exec sed -i.bak -E -e \ + "s|(github\\.com/apache/arrow/go)/v[0-9]+|\1/v${major_version}|g" {} \; # update parquet writer version sed -i.bak -E -e \ "s/\"parquet-go version .+\"/\"parquet-go version ${version}\"/" \ diff --git a/go/README.md b/go/README.md index 5b3f72760f331..660549cb1b366 100644 --- a/go/README.md +++ b/go/README.md @@ -20,7 +20,7 @@ Apache Arrow for Go =================== -[![GoDoc](https://godoc.org/github.com/apache/arrow/go/arrow?status.svg)](https://godoc.org/github.com/apache/arrow/go/arrow) +[![Go Reference](https://pkg.go.dev/badge/github.com/apache/arrow/go/v14.svg)](https://pkg.go.dev/github.com/apache/arrow/go/v14) [Apache Arrow][arrow] is a cross-language development platform for in-memory data. It specifies a standardized language-independent columnar memory format diff --git a/go/arrow/flight/flightsql/driver/README.md b/go/arrow/flight/flightsql/driver/README.md index f81cb9250e1c9..b8850527c19c1 100644 --- a/go/arrow/flight/flightsql/driver/README.md +++ b/go/arrow/flight/flightsql/driver/README.md @@ -36,7 +36,7 @@ connection pooling, transactions combined with ease of use (see (#usage)). ## Prerequisites * Go 1.17+ -* Installation via `go get -u github.com/apache/arrow/go/v12/arrow/flight/flightsql` +* Installation via `go get -u github.com/apache/arrow/go/v14/arrow/flight/flightsql` * Backend speaking FlightSQL --------------------------------------- @@ -55,7 +55,7 @@ import ( "database/sql" "time" - _ "github.com/apache/arrow/go/v12/arrow/flight/flightsql" + _ "github.com/apache/arrow/go/v14/arrow/flight/flightsql" ) // Open the connection to an SQLite backend @@ -141,7 +141,7 @@ import ( "log" "time" - "github.com/apache/arrow/go/v12/arrow/flight/flightsql" + "github.com/apache/arrow/go/v14/arrow/flight/flightsql" ) func main() {