Skip to content

Commit

Permalink
chore: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
chase-crumbaugh committed Jun 3, 2024
1 parent 0b2d641 commit 90466a2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
8 changes: 0 additions & 8 deletions main/main.go

This file was deleted.

6 changes: 3 additions & 3 deletions workflow/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import (
"strings"
)

type FileStatus int
type fileStatus int

const (
fileStatusLocal FileStatus = iota
fileStatusLocal fileStatus = iota
fileStatusNotExists
fileStatusRemote
fileStatusRegistry
)

func GetFileStatus(filePath string) FileStatus {
func getFileStatus(filePath string) fileStatus {
if strings.Contains(filePath, "registry.speakeasyapi.dev") {
return fileStatusRegistry
}
Expand Down
6 changes: 3 additions & 3 deletions workflow/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (s Source) GetOutputLocation() (string, error) {
if len(s.Inputs) == 1 && len(s.Overlays) == 0 {
inputFile := s.Inputs[0].Location

switch GetFileStatus(inputFile) {
switch getFileStatus(inputFile) {
case fileStatusRegistry:
return filepath.Join(GetTempDir(), fmt.Sprintf("registry_%s", randStringBytes(10))), nil
case fileStatusLocal:
Expand Down Expand Up @@ -134,7 +134,7 @@ func (d Document) Validate() error {
}

if d.Auth != nil {
if GetFileStatus(d.Location) != fileStatusRemote {
if getFileStatus(d.Location) != fileStatusRemote {
return fmt.Errorf("auth is only supported for remote documents")
}

Expand All @@ -147,7 +147,7 @@ func (d Document) Validate() error {
}

func (d Document) IsRemote() bool {
return GetFileStatus(d.Location) == fileStatusRemote
return getFileStatus(d.Location) == fileStatusRemote
}

func (d Document) IsSpeakeasyRegistry() bool {
Expand Down
2 changes: 1 addition & 1 deletion workflow/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (t Target) Validate(supportedLangs []string, sources map[string]Source) err
return fmt.Errorf("failed to validate source %s: %w", t.Source, err)
}
} else {
switch GetFileStatus(t.Source) {
switch getFileStatus(t.Source) {
case fileStatusNotExists:
return fmt.Errorf("source %s does not exist", t.Source)
}
Expand Down

0 comments on commit 90466a2

Please sign in to comment.