• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mishankov / platforma / 18815992996

26 Oct 2025 09:24AM UTC coverage: 9.617% (+0.04%) from 9.581%
18815992996

Pull #9

github

mishankov
style: align struct tags in auth and session models

- Standardize struct tag ordering in User and Session structs to have db tags before json tags
- Add staticcheck and tagalign linters to golangci configuration
- Update linter configuration comments for better maintainability
Pull Request #9: Linter configuration

11 of 42 new or added lines in 7 files covered. (26.19%)

69 existing lines in 7 files now uncovered.

98 of 1019 relevant lines covered (9.62%)

0.33 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/auth/handler_get.go
1
package auth
2

3
import (
4
        "encoding/json"
5
        "net/http"
6

7
        "github.com/mishankov/platforma/log"
8
)
9

10
type GetHandler struct {
11
        service *Service
12
}
13

14
func NewGetHandler(service *Service) *GetHandler {
×
15
        return &GetHandler{
×
16
                service: service,
×
17
        }
×
18
}
×
19

20
func (h *GetHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
×
21
        if r.Method != http.MethodGet {
×
22
                http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
×
23
                return
×
24
        }
×
25

26
        ctx := r.Context()
×
27

×
28
        cookie, err := r.Cookie(h.service.CookieName())
×
29
        if err != nil {
×
30
                w.WriteHeader(http.StatusUnauthorized)
×
31
                return
×
32
        }
×
33

34
        user, err := h.service.GetFromSession(ctx, cookie.Value)
×
35
        if err != nil {
×
36
                http.Error(w, err.Error(), http.StatusInternalServerError)
×
37
                return
×
38
        }
×
39

40
        if user == nil {
×
41
                w.WriteHeader(http.StatusUnauthorized)
×
42
                return
×
43
        }
×
44

45
        w.Header().Set("Content-Type", "application/json")
×
46

×
47
        var resp = struct {
×
48
                Username string `json:"username"`
×
49
        }{
×
50
                Username: user.Username,
×
51
        }
×
52

×
NEW
53
        err = json.NewEncoder(w).Encode(resp)
×
NEW
54
        if err != nil {
×
NEW
55
                log.ErrorContext(ctx, "failed to decode response to json", "error", err)
×
NEW
56
        }
×
57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc