Skip to content

authz: correctly marshal Perms for logging

Warren Gifford requested to merge k/go115-test into main

Created by: keegancsmith

In go1.15 the authz tests fail with the following: conversion from Perms (uint32) to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)

Instead of directly calling "Perm.String()" (or indirectly via "fmt.Sprint") we use trace.Stringer which is a lazy logger. It will only call the function if we actually consume the log somewhere (so will avoid the work if we are not tracing that request).

There is an alternative implementation of this change in https://github.com/sourcegraph/sourcegraph/pull/13433. I would like to land this now since it will fix go test for those who have already upgraded.

Merge request reports

Loading