Giter VIP home page Giter VIP logo

client-pkg's People

Contributors

cali0707 avatar cardil avatar dsimansk avatar evankanderson avatar kellyaa avatar knative-automation avatar retocode avatar rhuss avatar vyasgun avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

client-pkg's Issues

SIGSEGV thrown often from Spinner and Progress release terminal procedure

SIGSEGV is thrown quite often from:

if term.IsWriterTerminal(out) {
_ = t.ReleaseTerminal()
}

Here's goroutines dump:

$ go run github.com/cardil/repro-kn-cli-bad-license@latest
Loading... Done
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x569e90]

goroutine 6 [running]:
github.com/charmbracelet/bubbletea.(*Program).ReleaseTerminal(0xc000189450)
	/home/ksuszyns/.gvm/pkgsets/go1.21.4/global/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:651 +0x30
knative.dev/client-pkg/pkg/output/tui.(*BubbleSpinner).start.func1()
	/home/ksuszyns/.gvm/pkgsets/go1.21.4/global/pkg/mod/knative.dev/[email protected]/pkg/output/tui/spinner.go:94 +0xa5
created by knative.dev/client-pkg/pkg/output/tui.(*BubbleSpinner).start in goroutine 1
	/home/ksuszyns/.gvm/pkgsets/go1.21.4/global/pkg/mod/knative.dev/[email protected]/pkg/output/tui/spinner.go:87 +0x396
exit status 2

/kind bug

github.com/mattn/go-localereader is reported in downstream projects by google/go-licenses tool

Bug description

Bubbletea is using the github.com/mattn/go-localereader as a dependency. It is used only for Windows, and maybe that's why it isn't reported here, by our go-licenses tooling. This lib is not very well maintained, as the only available version (v0.0.1), doesn't contain a license file. The license has been added to the main branch, however.

On downstream projects, it is reported by go-licenses as having missing license. Maybe this is because of it, being vendored here, IDK?

Unknown license type  found for library github.com/mattn/go-localereader

/kind bug

Steps to reproduce

  1. Checkout https://github.com/cardil/repro-kn-cli-bad-license
  2. Run test: go run github.com/google/go-licenses@latest check ./...
  3. You should license check failing, with error:
    Unknown license type  found for library github.com/mattn/go-localereader
    

Safeguard for charmbracelet/bubbletea#964 prevents using regular `stdin`

The following block prevents from using regular stdin with tui.Spinner and tui.Progress:

if !st.Mode().IsRegular() {
if st.Name() != os.DevNull {
log.Println("WARN: non-regular file given as input: ",
st.Name(), " (mode: ", st.Mode(),
"). Using `nil` as input.")
}
return nil
}

The following situation happens:

$ go run github.com/cardil/repro-kn-cli-bad-license@latest
2024/03/27 11:37:43 WARN: non-regular file given as input:  stdin  (mode:  Dcrw--w---- ). Using `nil` as input.

/kind bug

Fixing #168 once again uncovered the charmbracelet/bubbletea#964 bug

Fixing #168 with #170 we have, once again, uncovered the charmbracelet/bubbletea#964 bug.

See the error, here: https://prow.knative.dev/view/gs/knative-prow/pr-logs/pull/knative-extensions_kn-plugin-event/339/integration-tests_kn-plugin-event_main/1773009898955608064#1:build-log.txt%3A644

To confirm that, you can checkout the knative-extensions/kn-plugin-event#339, and run (passing a file as stdin):

$ ./mage clean build < go.mod
[MAGE] 🚿 Cleaning... done.
[MAGE] 🔧 Installing tools
[MAGE] 🔧 › Go install "gotest.tools/gotestsum@latest"
[MAGE] 🔧 › Go install "gotest.tools/gotestsum@latest" › installed
[MAGE] 🔧 › Pre-built binary "golangci/[email protected]"
⛳️ Getting information about v1.55.2 release ▱▱⛳️ Getting information about v1.55.2 release Done
[MAGE] 🔧 Pre-built binary "golangci/[email protected]" have failed: error creating cancelreader: add reader to epoll interest list
Error: error creating cancelreader: add reader to epoll interest list
exit status 1

It looks like the /dev/stdin doesn't support the epoll thing.

/kind bug

Make package naming more consistent with skipping `kn` in the sub-dirs

Hmm, the package knative.dev/client-pkg/pkg/config already exists, as well. I believe, that's why I put it in here...

We should reconcile those two packages somehow. IMHO, we shouldn't be using the kn sub-package, as all of those packages are kn related, obviously.

IDK, maybe we should dump the kn sub-package, probably in a separate PR, to avoid confusion. But, that's a breaking change, so we should prepare migration as well.

WDYT on those two, already existing, config packages?

Originally posted by @cardil in #139 (comment)


Per the conversation on the linked PR. Let's follow-up on the package name changes.

Remove the additional explicit wait "hack" in progress bar

The additional explicit wait "hack" in the progress bar should be removed. If your UI has a lot of progress bars, this wait will be visible.

func (b *BubbleProgress) quitSignal() tea.Cmd {
// The final pause is to give the progress bar a chance to finish its
// animation before quitting. Otherwise, it ends abruptly, and the user
// might not see the progress bar at 100%.
return tea.Sequence(b.finalPause(), tea.Quit)
}

But, I don't see a way, with the current API of bubbles' progress, to achieve it otherwise...

Without the wait, we get UI with progress bars that are never 100% completed. See example: #162 (comment)

Originally posted by @cardil in #162 (comment)

The knative.dev/client-pkg/pkg/kn-source-pkg sub-package should be renamed and flatten

The knative.dev/client-pkg/pkg/kn-source-pkg sub-package was introduced in #74, but contains some weird stuff, that shouldn't be present in a library:

Let's clean up this as well, and leave just the actual library, just renamed to knative.dev/client-pkg/plugin/source/....

Originally posted by @cardil in #155 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.