Eng Zer Jun

Results 49 issues of Eng Zer Jun

### Description Replace `strings.Replace(s, old, new, -1)` with `strings.ReplaceAll(s, old, new)`. `strings.ReplaceAll` is a wrapper function for `strings.Replace`, but `strings.ReplaceAll` is more readable and removes the hardcoded `-1`. ### PR...

## Change Description Follow up of comment https://github.com/lightningnetwork/lnd/pull/6710#pullrequestreview-1082647392, this PR replaces `defer cleanup()` calls with `t.Cleanup` in tests. The main reason for using `t.Cleanup` is to simplify the resource creation...

code health
tests

**What this PR does / why we need it**: The `io/ioutil` package has been deprecated in Go 1.16 (See https://pkg.go.dev/io/ioutil). This PR replaces the existing `io/ioutil` functions with their new...

size/XL

# Description This PR replaces all `ioutil.ReadDir` to `os.ReadDir`. `ioutil.ReadDir` has been deprecated in Go 1.16. The new `os.ReadDir` is a more efficient implementation than `ioutil.ReadDir`. The full proposal can...

impact/no-changelog-required

**What this PR does / why we need it**: The `io/ioutil` package has been deprecated in Go 1.16 (See https://pkg.go.dev/io/ioutil). This PR replaces the existing `io/ioutil` functions with their new...

size/XL
sig/operator

The `io/ioutil` package has been deprecated in Go 1.16 (See https://pkg.go.dev/io/ioutil). This PR replaces the existing `io/ioutil` functions with their new definitions in `io` and `os` packages. - `ioutil.Discard` =>...

3.0

The `io/ioutil` package has been deprecated in Go 1.16 (See https://pkg.go.dev/io/ioutil). This PR replaces the existing `io/ioutil` functions with their new definitions in `io` and `os` packages. - `ioutil.Discard` =>...

This PR replaces `os.Setenv` with `t.Setenv`. Starting from Go 1.17, we can use `t.Setenv` to set environment variable in test. The environment variable is automatically restored to its original value...

A testing cleanup. This pull request replaces `os.MkdirTemp` with `t.TempDir`. We can use the `T.TempDir` function from the `testing` package to create temporary directory. The directory created by `T.TempDir` is...

A testing cleanup. This pull request replaces `ioutil.TempDir` with `t.TempDir`. We can use the `T.TempDir` function from the `testing` package to create temporary directory. The directory created by `T.TempDir` is...