Repository: urfave/cli
Pull request #1323 (2022-01-04 03:52:54)

Bump Go version range in CI to 1.15-1.17
<!--
  This template provides some ideas of things to include in your PR description.
  To start, try providing a short summary of your changes in the Title above.
  If a section of the PR template does not apply to this PR, then delete that section.
 -->

## What type of PR is this?

_(REQUIRED)_

- [ ] bug
- [x] cleanup  
- [ ] documentation
- [ ] feature

## What this PR does / why we need it:

_(REQUIRED)_

<!--
  What goal is this change working towards?
  Provide a bullet pointed summary of how each file was changed.
  Briefly explain any decisions you made with respect to the changes.
  Include anything here that you didn't include in *Release Notes*
  above, such as changes to CI or changes to internal methods.
-->
Only support latest 3 versions, and more urgently, stop the binary size from failing CI on Go 1.14 (which we presumably no longer care about). 

## Which issue(s) this PR fixes:

_(REQUIRED)_
<!--
If this PR fixes one of more issues, list them here.
One line each, like so:

Fixes #123
Fixes #39
-->

## Special notes for your reviewer:

_(fill-in or delete this section)_

<!--
   Is there any particular feedback you would / wouldn't like?
   Which parts of the code should reviewers focus on?
-->

## Testing

_(fill-in or delete this section)_

<!--
  Describe how you tested this change.
-->

## Release Notes

_(REQUIRED)_
<!--
  If this PR makes user facing changes, please describe them here. This
  description will be copied into the release notes/changelog, whenever the
  next version is released. Keep this section short, and focus on high level
  changes.

  Put your text between the block. To omit notes, use NONE within the block.
-->

```release-note
NONE
```


rliebz: @urfave/cli quick version bump if anyone is around to approve. 

Patch:
diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml
index edeebdf..e3b7a97 100644
--- a/.github/workflows/cli.yml
+++ b/.github/workflows/cli.yml
@@ -15,7 +15,7 @@ jobs:
     strategy:
       matrix:
         os: [ubuntu-latest, macos-latest, windows-latest]
-        go: [1.14, 1.15, 1.16]
+        go: [1.15, 1.16, 1.17]
     name: ${{ matrix.os }} @ Go ${{ matrix.go }}
     runs-on: ${{ matrix.os }}
     steps:
@@ -38,7 +38,7 @@ jobs:
           ref: ${{ github.ref }}
 
       - name: GOFMT Check
-        if: matrix.go == 1.16 && matrix.os == 'ubuntu-latest'
+        if: matrix.go == 1.17 && matrix.os == 'ubuntu-latest'
         run: test -z $(gofmt -l .)
 
       - name: vet
@@ -51,7 +51,7 @@ jobs:
         run: go run internal/build/build.go check-binary-size
 
       - name: Upload coverage to Codecov
-        if: success() && matrix.go == 1.16 && matrix.os == 'ubuntu-latest'
+        if: success() && matrix.go == 1.17 && matrix.os == 'ubuntu-latest'
         uses: codecov/codecov-action@v1
         with:
           fail_ci_if_error: true
@@ -63,7 +63,7 @@ jobs:
       - name: Set up Go
         uses: actions/setup-go@v1
         with:
-          # Currently fails on 1.16
+          # Currently fails on 1.16+
           go-version: 1.15
 
       - name: Use Node.js 12.x
diff --git a/context.go b/context.go
index 94cbb65..da090e8 100644
--- a/context.go
+++ b/context.go
@@ -151,6 +151,9 @@ func (ctx *Context) lookupFlag(name string) Flag {
 
 func (ctx *Context) lookupFlagSet(name string) *flag.FlagSet {
 	for _, c := range ctx.Lineage() {
+		if c.flagSet == nil {
+			continue
+		}
 		if f := c.flagSet.Lookup(name); f != nil {
 			return c.flagSet
 		}


Test patch:
diff --git a/context_test.go b/context_test.go
index b37876c..8475706 100644
--- a/context_test.go
+++ b/context_test.go
@@ -112,6 +112,8 @@ func TestContext_String(t *testing.T) {
 	c := NewContext(nil, set, parentCtx)
 	expect(t, c.String("myflag"), "hello world")
 	expect(t, c.String("top-flag"), "hai veld")
+	c = NewContext(nil, nil, parentCtx)
+	expect(t, c.String("top-flag"), "hai veld")
 }
 
 func TestContext_Path(t *testing.T) {