diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 57662e33..8b643af9 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -10,7 +10,7 @@ jobs: Test: strategy: matrix: - go-version: [1.18.x, 1.21.x] + go-version: [1.19.x, 1.21.x] os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} steps: diff --git a/go.mod b/go.mod index 461f621b..daf4b616 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/goplus/gogen -go 1.18 +go 1.19 require golang.org/x/tools v0.19.0 diff --git a/internal/go/printer/printer.go b/internal/go/printer/printer.go index a4897835..a2b9582f 100644 --- a/internal/go/printer/printer.go +++ b/internal/go/printer/printer.go @@ -609,7 +609,7 @@ func stripCommonPrefix(lines []string) { last := lines[len(lines)-1] closing := "*/" i := strings.Index(last, closing) // i >= 0 (closing is always present) - if isBlank(last[0:i]) { + if i >= 0 && isBlank(last[0:i]) { // last line only contains closing */ if lineOfStars { closing = " */" // add blank to align final star