- 1
- 2
func verbMatches(p abac.Policy, a authorizer.Attributes) bool {
// TODO: match on verb
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
func verbMatches(p abac.Policy, a authorizer.Attributes) bool {
// TODO: match on verb
серёга, задолбал, давай уже в прод катить, потом свою авторизацию сделаешь
https://github.com/kubernetes/kubernetes/blob/master/pkg/auth/authorizer/abac/abac.go#L178
0
switch platform {
case "Azure":
heartbeat = "500"
default:
heartbeat = "100"
}
Инфраструктуру для мимосервисов чай тоже люди пишут.
https://github.com/openshift/cluster-etcd-operator/blob/release-4.5/pkg/cmd/render/env.go#L52-L81
[size=8]там еще и табы[/size]
0
https://m.vk.com/wall-30666517_1672469
Из исходников и документации Go убрали фразы whitelist/blacklist и master/slave.
Всё из-за протестов, которые сейчас проходят в Америке.
Фразы «blacklist» и «whitelist» заменили на «blocklist» и «allowlist», а «master» и «slave»
в зависимости от контекста на «process», «pty», «proc» и «control».
Отмечается, что изменения не приведут к нарушению обратной совместимости и путанице, так как
большая часть исправлений приходится на комментарии, тесты и внутренние переменные.
0
func GetUser() *User {
defer func() {
time.Sleep(100 * time.Millisecond)
}()
return &User{}
}
Паттерн: поработал - отдохни.
Pattern: worked hard - have a rest
+1
func (svc *UserSvc) isEmptyName(name model.User_Name) bool {
if name.First.RU == "" {
if name.First.EN == "" {
if name.First.TR == "" {
if name.First.IT == "" {
if name.Last.RU == "" {
if name.Last.EN == "" {
if name.Last.TR == "" {
if name.Last.IT == "" {
return true
}
}
}
}
}
}
}
}
return false
}
Проверка заполненности имени пользователя хотя - бы на одном из языков.
−1
Currently, we're ignoring failures to mlock signal stacks in the
workaround for #35777. This means if your mlock limit is low, you'll
instead get random memory corruption, which seems like the wrong
trade-off.
самый лучший язык на свете продолжает шпарить, отказались от free after use - получили «забыл сделать if (err != nil)»
https://github.com/golang/go/commit/69614c0d0e05787c8203bdc364c3293e1cf5094a
+3
// sumEqual reports whether u + v == w exactly.
func sumEqual(u, v, w float64) bool {
return (u+v == w) && (u == w-v) && (v == w-u)
}
https://github.com/golang/geo/blob/a8523298cefedcf7b70bbbf4eeef24cbb3258376/s2/edge_clipping.go#L182
походу питух-затейник опять сбежал
0
// GostServer is the type that contains all of the relevant information to set
// up the GOST HTTP Server
type GostServer struct {
host string // Hostname for example "localhost" or "192.168.1.14"
port int // Port number where you want to run your http server on
api *models.API // SensorThings api to interact with from the HttpServer
https bool
httpsCert string
httpsKey string
httpServer *http.Server
}
// CreateServer initialises a new GOST HTTPServer based on the given parameters
func CreateServer(host string, port int, api *models.API, https bool, httpsCert, httpsKey string) Server {
setupLogger()
a := *api
router := CreateRouter(api)
return &GostServer{
host: host,
port: port,
api: api,
https: https,
httpsCert: httpsCert,
httpsKey: httpsKey,
httpServer: &http.Server{
Addr: fmt.Sprintf("%s:%s", host, strconv.Itoa(port)),
Handler: PostProcessHandler(RequestErrorHandler(LowerCaseURI(router)), a.GetConfig().Server.ExternalURI),
ReadTimeout: 30 * time.Second,
WriteTimeout: 30 * time.Second,
},
}
}
// Start command to start the GOST HTTPServer
func (s *GostServer) Start() {
t := "HTTP"
if s.https {
t = "HTTPS"
}
logger.Infof("Started GOST %v Server on %v:%v", t, s.host, s.port)
var err error
if s.https {
err = s.httpServer.ListenAndServeTLS(s.httpsCert, s.httpsKey)
} else {
err = s.httpServer.ListenAndServe()
}
if err != nil {
logger.Panicf("GOST server not properly stopped: %v", err)
}
}
// Stop command to stop the GOST HTTP server
func (s *GostServer) Stop() {
if s.httpServer != nil {
logger.Info("Stopping HTTP(S) Server")
s.httpServer.Shutdown(context.Background())
}
}
Нашёл ГостСервер го
https://github.com/gost/server/blob/master/http/gostserver.go
−2
TOCTOU race condition in Docker allows root access to the filesystem of the host platform.[4]
−2
Ьут оказывается go есть