Fix linter warnings
This commit is contained in:
parent
368bd8eefb
commit
7f0b52c5b5
6 changed files with 16 additions and 8 deletions
|
@ -30,6 +30,7 @@ const (
|
|||
httpReadHeaderTimeout = 5 * time.Second
|
||||
httpReadTimeout = 5 * time.Second
|
||||
httpWriteTimeout = 10 * time.Second
|
||||
smtpPort = 25
|
||||
smtpTimeout = 10 * time.Second
|
||||
)
|
||||
|
||||
|
@ -80,7 +81,7 @@ func parseConfig(configFile string) (*Config, error) {
|
|||
},
|
||||
MailConfig: &mailConfig{
|
||||
SMTPHost: "localhost",
|
||||
SMTPPort: 25,
|
||||
SMTPPort: smtpPort,
|
||||
SMTPTimeOut: smtpTimeout,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -659,8 +659,10 @@ func (app *application) healthCheck(w http.ResponseWriter, _ *http.Request) {
|
|||
w.Header().Set("Refresh", "10")
|
||||
w.Header().Add("Cache-Control", "no-store")
|
||||
|
||||
var err error
|
||||
var hasErrors = false
|
||||
var (
|
||||
err error
|
||||
hasErrors = false
|
||||
)
|
||||
|
||||
if err = app.mailNotifier.Ping(); err != nil {
|
||||
hasErrors = true
|
||||
|
|
|
@ -48,8 +48,9 @@ func prepareTestDb(t *testing.T) *sqlx.DB {
|
|||
return dbx
|
||||
}
|
||||
|
||||
func StartTestTcpServer(t *testing.T) int {
|
||||
func StartTestTCPServer(t *testing.T) int {
|
||||
t.Helper()
|
||||
|
||||
port, err := tcputil.EmptyPort()
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -68,6 +69,7 @@ func StartTestTcpServer(t *testing.T) int {
|
|||
|
||||
if err != nil {
|
||||
t.Errorf("could not accept connection: %v", err)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -81,7 +83,7 @@ func StartTestTcpServer(t *testing.T) int {
|
|||
}
|
||||
|
||||
func TestApplication_healthCheck(t *testing.T) {
|
||||
port := StartTestTcpServer(t)
|
||||
port := StartTestTCPServer(t)
|
||||
|
||||
t.Run("check with valid DB", func(t *testing.T) {
|
||||
rr := httptest.NewRecorder()
|
||||
|
|
|
@ -40,7 +40,8 @@ type RemindVotersJob struct {
|
|||
}
|
||||
|
||||
func (r *RemindVotersJob) Schedule() {
|
||||
// TODO: check logic. It would make more sense to remind at a specific interval before the next pending decision is closed
|
||||
// TODO: check logic. It would make more sense to remind at a specific interval before the next pending
|
||||
// decision is closed
|
||||
const reminderDays = 3
|
||||
|
||||
year, month, day := time.Now().UTC().Date()
|
||||
|
@ -235,8 +236,8 @@ func (js *JobScheduler) Schedule() {
|
|||
|
||||
for {
|
||||
select {
|
||||
case jobId := <-js.rescheduleChannel:
|
||||
js.jobs[jobId].Schedule()
|
||||
case jobID := <-js.rescheduleChannel:
|
||||
js.jobs[jobID].Schedule()
|
||||
case <-js.quitChannel:
|
||||
for _, job := range js.jobs {
|
||||
job.Stop()
|
||||
|
|
|
@ -70,6 +70,7 @@ func (app *application) authenticateRequest(r *http.Request) (*models.User, *x50
|
|||
clientCert := r.TLS.PeerCertificates[0]
|
||||
|
||||
allowClientAuth := false
|
||||
|
||||
for _, eku := range clientCert.ExtKeyUsage {
|
||||
if eku == x509.ExtKeyUsageClientAuth {
|
||||
allowClientAuth = true
|
||||
|
|
|
@ -53,6 +53,7 @@ func NotBlank(value string) bool {
|
|||
|
||||
func NotNil(value any) bool {
|
||||
val := reflect.ValueOf(value)
|
||||
|
||||
return !val.IsNil()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue