google / google/go-github

Move compatibility for non github.com targets to `github.With<THING>` options

Ouverte
#4,237 6 commentaires 2 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Go
Étoiles
11.3k
Forks
2.5k
Merge moyen
1 j 20 h
PR mergées (30 j)
53

Description

I propose that all compatibility functionality not required for the github.com target be removed from the default client setup and only be included via a `github.With` option. This (hopefully) would make the default client surface area simpler to understand. The justification for this is that you already need to use `github.WithEnterpriseURLs` to target non github.com. I propose the following changes to adopt this pattern, with the potential for other capabilities (such as enabling/disabling preview endpoints) to be added later.

- Default to the latest API version (`2026-03-10`)
- Functions that require a specific version now check against the client version and error if not valid
- Add `github.WithAPIVersion` to explicitly set a version
- Set at the client/service level
- Add `github.WithAdvancedServer` to enable GHAS support
- Better validation of inputs
- Support setting version
- Add compatibility accordingly
- Add `github.WithEnterpriseCloud` to enable GHEC support
- Better validation of inputs
- Deprecate `github.WithEnterpriseURLs`

I'd appreciate any feedback on this proposal.

cc: @gmlewis - @alexandear - @zyfy29 - @Not-Dhananjay-Mishra - @munlicode

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par examiner la configuration par défaut du client, l’option existante github.WithEnterpriseURLs et les vérifications de compatibilité décrites dans la proposition. Suivez la manière dont les versions de l’API et les cibles autres que github.com sont actuellement configurées. Le travail est considéré comme terminé lorsque le comportement proposé de WithAPIVersion, WithAdvancedServer et WithEnterpriseCloud est conçu et implémenté de manière cohérente, et que l’option obsolète est prise en charge.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
go
Domaine
api, backend-api-design
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.