Verified Commit 6be8ec66 authored by Vladimir Hodakov's avatar Vladimir Hodakov 🔥
Browse files

Fix linting errors

parent 1fbeb6c0
run:
deadline: 5m
linters:
enable-all: true
disable:
- gochecknoglobals
- goimports
- gocritic
linters-settings:
lll:
line-length: 420
gocyclo:
min-complexity: 40
issues:
exclude-rules:
- path: "exported.go"
linters:
- dupl
......@@ -16,9 +16,9 @@ func authorize() {
baseURL := "https://oauth.yandex.ru/authorize?response_type=code&client_id={{ client_id }}"
baseURL += "&device_id={{ device_id }}&device_name={{ device_name }}&force_confirm=yes"
baseURL = strings.Replace(baseURL, "{{ client_id }}", YANDEX_APPID, 1)
baseURL = strings.Replace(baseURL, "{{ client_id }}", YandexAppID, 1)
baseURL = strings.Replace(baseURL, "{{ device_id }}", c.Config.DeviceID, 1)
baseURL = strings.Replace(baseURL, "{{ device_name }}", DEVICE_NAME, 1)
baseURL = strings.Replace(baseURL, "{{ device_name }}", DefaultDeviceName, 1)
dlog.Info().Msg("Please open in your browser this URL and authorize the app. After getting the code restart the app with -authCode param (see -h for details).")
dlog.Info().Msgf("Auth URL: %s", baseURL)
......@@ -29,9 +29,5 @@ func authorize() {
// checkAuth detects if we have authorized already
func checkAuth() bool {
if c.Config.Token.AccessToken != "" {
return true
}
return false
return c.Config.Token.AccessToken != ""
}
......@@ -9,10 +9,10 @@ import (
"gitlab.com/pztrn/flagger"
)
const YANDEX_APPID = "7d8a0561fdc44c05bb6695b464403f9c"
const YANDEX_APPPW = "56e12e4ed0d64738bf441a47f68c7146"
const DEVICE_NAME = "yapusher-cli"
const MAX_FILE_SIZE = 10 * 1024 * 1024 * 1024 // 10 gigabytes
const YandexAppID = "7d8a0561fdc44c05bb6695b464403f9c"
const YandexAppPw = "56e12e4ed0d64738bf441a47f68c7146"
const DefaultDeviceName = "yapusher-cli"
const MaxUploadSize = 10 * 1024 * 1024 * 1024 // 10 gigabytes
var (
c *context.Context
......
......@@ -14,9 +14,6 @@ import (
"strings"
)
func reportFileProgress(r int64) {
}
func sendCode(code int) {
baseURL := "https://oauth.yandex.ru/token"
......@@ -25,9 +22,9 @@ func sendCode(code int) {
form.Set("grant_type", "authorization_code")
form.Set("code", strconv.Itoa(code))
form.Set("device_id", c.Config.DeviceID)
form.Set("device_name", DEVICE_NAME)
form.Set("client_id", YANDEX_APPID)
form.Set("client_secret", YANDEX_APPPW)
form.Set("device_name", DefaultDeviceName)
form.Set("client_id", YandexAppID)
form.Set("client_secret", YandexAppPw)
req, _ := http.NewRequest("POST", baseURL, strings.NewReader(form.Encode()))
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
......@@ -78,7 +75,7 @@ func uploadFile(uploadPath string, filePath string, overwriteFile bool) {
}
}
if fileInfo.Size() > (MAX_FILE_SIZE - 1) {
if fileInfo.Size() > (MaxUploadSize - 1) {
dlog.Fatal().Msg("Requested file is too big")
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment