updated comments in structs, updated error handler
This commit is contained in:
parent
2984d3da01
commit
ca671e035f
11
functions.go
11
functions.go
@ -167,10 +167,8 @@ func MigrateReposToGogs(config *Config, repolist []GitHubRepo) {
|
|||||||
|
|
||||||
client.Timeout = config.globalconfig.RequestTimeout
|
client.Timeout = config.globalconfig.RequestTimeout
|
||||||
|
|
||||||
resp, err := client.Do(req)
|
_, err = client.Do(req)
|
||||||
HandleError(err)
|
HandleFatalError(err)
|
||||||
|
|
||||||
fmt.Println(resp.StatusCode)
|
|
||||||
} else {
|
} else {
|
||||||
fmt.Println(fmt.Sprintf("Not migrating, %s exists in gogs", elem.Name))
|
fmt.Println(fmt.Sprintf("Not migrating, %s exists in gogs", elem.Name))
|
||||||
}
|
}
|
||||||
@ -178,11 +176,10 @@ func MigrateReposToGogs(config *Config, repolist []GitHubRepo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// HandleError handles errors to return err
|
// HandleError handles errors to return err
|
||||||
func HandleError(err error) error {
|
func HandleError(err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
log.Println(err)
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// HandleFatalError fatal errors
|
// HandleFatalError fatal errors
|
||||||
|
10
types.go
10
types.go
@ -14,7 +14,7 @@ type GogsOrg struct {
|
|||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GogsMigrateRepo ...
|
// GogsMigrateRepo defines the repo to migrate
|
||||||
type GogsMigrateRepo struct {
|
type GogsMigrateRepo struct {
|
||||||
Name string
|
Name string
|
||||||
CloneURL string
|
CloneURL string
|
||||||
@ -22,20 +22,20 @@ type GogsMigrateRepo struct {
|
|||||||
Mirror bool
|
Mirror bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config ...
|
// Config merge all config elements
|
||||||
type Config struct {
|
type Config struct {
|
||||||
globalconfig GlobalConfig
|
globalconfig GlobalConfig
|
||||||
gogsconfig GogsConfig
|
gogsconfig GogsConfig
|
||||||
githubconfig GitHubConfig
|
githubconfig GitHubConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
// GlobalConfig ...
|
// GlobalConfig is the global config of github-to-gogs
|
||||||
type GlobalConfig struct {
|
type GlobalConfig struct {
|
||||||
RequestTimeout time.Duration
|
RequestTimeout time.Duration
|
||||||
UserAgent string
|
UserAgent string
|
||||||
}
|
}
|
||||||
|
|
||||||
// GitHubConfig ...
|
// GitHubConfig is the GitHub config
|
||||||
type GitHubConfig struct {
|
type GitHubConfig struct {
|
||||||
StarsPages string
|
StarsPages string
|
||||||
MaxPagesNumber int
|
MaxPagesNumber int
|
||||||
@ -44,7 +44,7 @@ type GitHubConfig struct {
|
|||||||
ContentType string
|
ContentType string
|
||||||
}
|
}
|
||||||
|
|
||||||
// GogsConfig ...
|
// GogsConfig is the Gogs config
|
||||||
type GogsConfig struct {
|
type GogsConfig struct {
|
||||||
UID int
|
UID int
|
||||||
Username string
|
Username string
|
||||||
|
Loading…
Reference in New Issue
Block a user