google / google/go-github

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

Abierto
#4,237 6 comentarios 2 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Go
Estrellas
11.3k
Forks
2.5k
Merge medio
1 d 20 h
PR fusionados (30 d)
53

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza revisando la configuración predeterminada del cliente, la opción existente github.WithEnterpriseURLs y las comprobaciones de compatibilidad descritas en la propuesta. Sigue cómo se configuran actualmente las versiones de la API y los destinos que no son github.com. Se considera terminado cuando el comportamiento propuesto de WithAPIVersion, WithAdvancedServer y WithEnterpriseCloud está diseñado e implementado de forma coherente, y se ha gestionado la opción obsoleta.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
go
Área
api, backend-api-design
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.