Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request updates the go-importmap package to improve functionality and documentation. Key changes include the addition of new CDN clients (esm.sh, skypack, unpkg, raw), the introduction of a GitHub Actions workflow for golangci-lint, and significant enhancements to the README.
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/golangci-lint.yml | Added GitHub Actions workflow to run golangci-lint on push/PR events |
| client/esmsh/esmsh.go | Added new client to fetch package files from esm.sh |
| client/esmsh/esmsh_test.go | Added tests for the esm.sh client |
| client/skypack/skypack.go & _test.go | New client and tests for fetching package files from skypack |
| client/unpkg/unpkg.go & _test.go | New client and tests for fetching package files from unpkg |
| client/jsdelivr/jsdelivr.go & _test.go | Updated error message formatting and adjusted test context usage |
| client/cdnjs/cdnjs.go & _test.go | Updated error message formatting for improved consistency |
| client/raw/raw.go | Added a raw provider and its error handling |
| README.md | Updated package description, new sections for supported providers, and a quick example |
| importmap.go | Updated default shim URL and provider handling in Fetch and logging |
| library/package.go | Introduced the Provider interface into the Package struct |
Comments suppressed due to low confidence (2)
client/raw/raw.go:24
- Consider validating the raw provider URL during initialization (in New) rather than waiting until FetchPackageFiles is called, to catch configuration errors earlier.
if p.URL == "" {
client/jsdelivr/jsdelivr.go:79
- [nitpick] Including the client name (e.g. jsdelivr) in the error message could improve clarity when debugging API response issues.
return nil, "", fmt.Errorf("client api responded with code %d", resp.StatusCode)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several updates to improve the functionality and documentation of the
go-importmappackage. The main changes include the addition of new funding models, the setup of a Go linter workflow, and significant enhancements to the README documentation. Additionally, new CDN clients and tests have been added to support various providers.Enhancements to documentation:
README.md: Simplified the package description, updated the features list, and added detailed usage examples. Removed outdated file structure information and added a new section on raw imports. [1] [2] [3] [4]New funding models:
.github/FUNDING.yml: Added multiple supported funding model platforms including GitHub Sponsors, Patreon, Open Collective, and more.Workflow improvements:
.github/workflows/golangci-lint.yml: Introduced a new GitHub Actions workflow for runninggolangci-linton push and pull request events to ensure code quality.New CDN clients and tests:
client/esmsh/esmsh.go: Added a new client for fetching package files fromesm.sh.client/esmsh/esmsh_test.go: Added tests for the newesm.shclient.client/raw/raw.go: Updated the raw provider to fetch files from a given URL.client/raw/raw_test.go: Added tests for the raw provider.Code quality improvements:
client/cdnjs/cdnjs.go: Replacederrors.Newwithfmt.Errorffor better error messages.client/jsdelivr/jsdelivr.go: Replacederrors.Newwithfmt.Errorffor better error messages. [1] [2]client/cdnjs/cdnjs_test.go: Updated tests to uset.Context(). [1] [2]client/jsdelivr/jsdelivr_test.go: Updated tests to uset.Context().