mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2026-03-14 14:35:44 +01:00
lint: Enable "errchkjson" and update json.Marshal error handling.
This commit is contained in:
parent
98060d48cb
commit
c581bc14d5
6 changed files with 13 additions and 19 deletions
|
|
@ -1,9 +1,13 @@
|
|||
version: "2"
|
||||
linters:
|
||||
enable:
|
||||
- errchkjson
|
||||
- misspell
|
||||
- revive
|
||||
settings:
|
||||
errchkjson:
|
||||
check-error-free-encoding: true
|
||||
report-no-exported: true
|
||||
govet:
|
||||
enable:
|
||||
- nilness
|
||||
|
|
|
|||
|
|
@ -167,12 +167,7 @@ func (b *BackendServer) Start(r *mux.Router) error {
|
|||
"nextcloud-spreed-signaling": "Welcome",
|
||||
"version": b.version,
|
||||
}
|
||||
welcomeMessage, err := json.Marshal(welcome)
|
||||
if err != nil {
|
||||
// Should never happen.
|
||||
return err
|
||||
}
|
||||
|
||||
welcomeMessage, _ := json.Marshal(welcome)
|
||||
b.welcomeMessage = string(welcomeMessage) + "\n"
|
||||
|
||||
if b.debug {
|
||||
|
|
|
|||
|
|
@ -75,10 +75,11 @@ func NewCapabilitiesForTestWithCallback(t *testing.T, callback func(*Capabilitie
|
|||
config := api.StringMap{
|
||||
"signaling": signaling,
|
||||
}
|
||||
spreedCapa, _ := json.Marshal(api.StringMap{
|
||||
spreedCapa, err := json.Marshal(api.StringMap{
|
||||
"features": features,
|
||||
"config": config,
|
||||
})
|
||||
require.NoError(err)
|
||||
emptyArray := []byte("[]")
|
||||
response := &CapabilitiesResponse{
|
||||
Version: CapabilitiesVersion{
|
||||
|
|
|
|||
|
|
@ -414,8 +414,7 @@ func processAuthRequest(t *testing.T, w http.ResponseWriter, r *http.Request, re
|
|||
userdata := map[string]string{
|
||||
"displayname": "Displayname " + params.UserId,
|
||||
}
|
||||
data, err := json.Marshal(userdata)
|
||||
require.NoError(err)
|
||||
data, _ := json.Marshal(userdata)
|
||||
response.Auth.User = data
|
||||
return response
|
||||
}
|
||||
|
|
@ -476,8 +475,7 @@ func processRoomRequest(t *testing.T, w http.ResponseWriter, r *http.Request, re
|
|||
data := map[string]string{
|
||||
"userid": "userid-from-sessiondata",
|
||||
}
|
||||
tmp, err := json.Marshal(data)
|
||||
require.NoError(err)
|
||||
tmp, _ := json.Marshal(data)
|
||||
response.Room.Session = tmp
|
||||
case "test-room-initial-permissions":
|
||||
permissions := []Permission{PERMISSION_MAY_PUBLISH_AUDIO}
|
||||
|
|
@ -777,10 +775,11 @@ func registerBackendHandlerUrl(t *testing.T, router *mux.Router, url string) {
|
|||
signaling[ConfigKeyHelloV2TokenKey] = string(public)
|
||||
}
|
||||
}
|
||||
spreedCapa, _ := json.Marshal(api.StringMap{
|
||||
spreedCapa, err := json.Marshal(api.StringMap{
|
||||
"features": features,
|
||||
"config": config,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
response := &CapabilitiesResponse{
|
||||
Version: CapabilitiesVersion{
|
||||
Major: 20,
|
||||
|
|
|
|||
|
|
@ -289,11 +289,7 @@ func NewProxyServer(ctx context.Context, r *mux.Router, version string, config *
|
|||
"nextcloud-spreed-signaling-proxy": "Welcome",
|
||||
"version": version,
|
||||
}
|
||||
welcomeMessage, err := json.Marshal(welcome)
|
||||
if err != nil {
|
||||
// Should never happen.
|
||||
return nil, err
|
||||
}
|
||||
welcomeMessage, _ := json.Marshal(welcome)
|
||||
|
||||
tokenId, _ := config.GetString("app", "token_id")
|
||||
var tokenKey *rsa.PrivateKey
|
||||
|
|
|
|||
|
|
@ -54,8 +54,7 @@ func newProxyConfigEtcd(t *testing.T, proxy McuProxy) (*embed.Etcd, ProxyConfig)
|
|||
|
||||
func SetEtcdProxy(t *testing.T, etcd *embed.Etcd, path string, proxy *TestProxyInformationEtcd) {
|
||||
t.Helper()
|
||||
data, err := json.Marshal(proxy)
|
||||
require.NoError(t, err)
|
||||
data, _ := json.Marshal(proxy)
|
||||
SetEtcdValue(etcd, path, data)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue