Merge remote-tracking branch 'origin' into go-1.19-upgrade

This commit is contained in:
Mislav Marohnić 2022-12-12 16:48:41 +01:00
commit d273005f40
No known key found for this signature in database
4 changed files with 7 additions and 22 deletions

View file

@ -14,6 +14,7 @@ const (
)
// This interface describes interacting with some persistent configuration for gh.
//
//go:generate moq -rm -out config_mock.go . Config
type Config interface {
AuthToken(string) (string, string)

View file

@ -29,24 +29,9 @@ func newSelectCmd(app *App) *cobra.Command {
return selectCmd
}
// Hidden codespace `select` command allows to reuse existing codespace selection
// dialog by external GH CLI extensions. By default output selected codespace name
// into `stdout`. Pass `--file`(`-f`) flag along with a file path to output selected
// codespace name into a file instead.
//
// ## Examples
//
// With `stdout` output:
//
// ```shell
// gh codespace select
// ```
//
// With `into-a-file` output:
//
// ```shell
// gh codespace select --file /tmp/selected_codespace.txt
// ```
// Hidden codespace select command allows to reuse existing codespace selection
// dialog by external GH CLI extensions. By default, print selected codespace name
// to stdout. Pass file argument to save result into a file instead.
func (a *App) Select(ctx context.Context, name string, opts selectOptions) (err error) {
codespace, err := getOrChooseCodespace(ctx, a.apiClient, name)
if err != nil {

View file

@ -3,7 +3,6 @@ package codespace
import (
"context"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
@ -103,7 +102,7 @@ func TestGenerateAutomaticSSHKeys(t *testing.T) {
}
// Check that no unexpected files are present
allExistingFiles, err := ioutil.ReadDir(dir)
allExistingFiles, err := os.ReadDir(dir)
if err != nil {
t.Errorf("Failed to list files in test directory: %v", err)
}

View file

@ -2,7 +2,7 @@ package status
import (
"bytes"
"io/ioutil"
"io"
"net/http"
"strings"
"testing"
@ -247,7 +247,7 @@ func TestStatusRun(t *testing.T) {
return &http.Response{
Request: req,
StatusCode: 403,
Body: ioutil.NopCloser(strings.NewReader(`{"message": "You don't have permission to access this resource."}`)),
Body: io.NopCloser(strings.NewReader(`{"message": "You don't have permission to access this resource."}`)),
Header: http.Header{
"Content-Type": []string{"application/json"},
"X-Github-Sso": []string{"required; url=http://click.me/auth"},