Skip to content

Instantly share code, notes, and snippets.

package hw06pipelineexecution
import (
"strconv"
"testing"
"time"
"github.com/stretchr/testify/require"
)
@kulti
kulti / .golangci.yml
Last active June 25, 2024 23:44
golangci-lint config workflow
# Comments started with [!] are explanations of my workflow with golangci-lint.
# Another comments are real comments in my config.
# [!] Examine the https://golangci-lint.run/usage/configuration/ to know all possibilities.
run:
timeout: 5m
modules-download-mode: vendor # [!] if you are using vendoring
build-tags:
- integration # [!] If you disable code for integration tests to run all unit tests, enable it to lint all the same.
@kulti
kulti / http_response_writer.go
Last active June 1, 2022 06:52
Wrap http.ResponseWriter with proxying another interfaces
func wrapResponseWriter(w http.ResponseWriter, codeHook func(int)) http.ResponseWriter {
rw := &rw{w: w, codeHook: codeHook}
hj, hasHijack := w.(http.Hijacker)
fl, hasFlusher := w.(http.Flusher)
rf, hasReadFrom := w.(io.ReaderFrom)
switch {
case hasHijack && hasFlusher && hasReadFrom:
return struct {
http.ResponseWriter