From bca5b3a7d67e4a3e17c3062c61fdd2279f333c26 Mon Sep 17 00:00:00 2001 From: Zhanghuixian Luo <52497196+piaodazhu@users.noreply.github.com> Date: Thu, 11 May 2023 10:05:22 +0800 Subject: [PATCH] bug: fix the missing log.Lmsgprefix in go1.13 (#275) Fixes #274 --------- Co-authored-by: Andy Pan --- .github/workflows/test.yml | 2 +- ants.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9ff8fef..35b5a8a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -59,7 +59,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v3 with: - go-version: '^1.13' + go-version: ${{ matrix.go }} - name: Print Go environment id: go-env diff --git a/ants.go b/ants.go index 6205cde..18b3dc8 100644 --- a/ants.go +++ b/ants.go @@ -82,7 +82,9 @@ var ( return 1 }() - defaultLogger = Logger(log.New(os.Stderr, "[ants]: ", log.LstdFlags|log.Lmsgprefix|log.Lmicroseconds)) + // log.Lmsgprefix is not available in go1.13, just make an identical value for it. + logLmsgprefix = 64 + defaultLogger = Logger(log.New(os.Stderr, "[ants]: ", log.LstdFlags|logLmsgprefix|log.Lmicroseconds)) // Init an instance pool when importing ants. defaultAntsPool, _ = NewPool(DefaultAntsPoolSize)