Git Product home page Git Product logo

Comments (2)

erikgeiser avatar erikgeiser commented on August 23, 2024 1

Hey, thanks for your feedback and sorry for the late reply. I'm not sure I understand you correctly, but as far as I can tell the examples are correct but you are using another version of the library locally. I'd like to give some context on the issue because it could be confusing for other people, too.

When I started writing the library I knew that a nice API for selection prompts would profit a lot from generics, but Go 1.18 was delayed, so I initially used the abstraction []*selection.Choices. However, I planned to change the API as soon as generics were available, that's also why I put a disclaimer in the README. Currently, the latest tagged version v0.7.0 still uses the abstraction.

The main branch, however, is already update to utilize generics. I'm guessing your problem is that go get github.com/erikgeiser/promptkit fetches the latest tagged version (v0.7.0 with []*selection.Choices) instead of the current state of the main branch, but when you look at the examples on Github, you already see the newer, untagged version with generics.

The reason I haven't tagged a new release yet is that I currently have little time and I want to help a few of the bigger projects that use promptkit to migrate by creating PRs because I want to avoid that they are put off by unexpected API changes. I haven't found the time to do that, yet.

The Fix:

If you are already using Go 1.18 or newer, you can use the latest, untagged version of promptkit with generics by specifying that you want to fetch the main branch like this:

go get github.com/erikgeiser/promptkit@main

If you are using an earlier Go version you can look at the examples at the snapshot of the currently tagged version v0.7.0 here:

https://github.com/erikgeiser/promptkit/tree/912fe7f8487dabfb392d159b9e5cb28a0f7e252e

I'm leaving this issue open so other people with the same problem can easily find it.

from promptkit.

erikgeiser avatar erikgeiser commented on August 23, 2024

I have now tagged and released a new version which fixes the mismatch between documentation and latest released version.

from promptkit.

Related Issues (15)

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.