Who doesn't write wrong codes? No one.
Then, programs don't work well, and developers write logs for debug to understand what happens.
However, some developers forget to delete their logs after resolving the problem and push their codes. In the worse case, the logs might be released.
dl is developed to resolve their problems.
- Logging package for debug in Go
- Command for parallel Sweeping all functions of this package
- Command for installing git hooks and .gitignore
It doesn't contain a generics feature.
$ go install github.com/task4233/dl/cmd/dl@v1
$ go install github.com/task4233/dl/v2/cmd/dl@main
- debug your codes with
dl
package
package main
import (
"os"
"github.com/task4233/dl/v2"
)
type U[T any] []T
func (t U[T]) append(v T) {
t = append(t, v)
// debug
dl.Info(t)
}
func (t U[T]) change(v T) {
t[0] = v
// debug
dl.FInfo(os.Stdout, t)
}
func main() {
t := U[int]([]int{1, 3})
t.append(5)
t.change(5)
}
// Output:
// [DeLog] info: main.U[int]{1, 3, 5} (main.U[int]) prog.go:13
// [DeLog] info: main.U[int]{5, 3} (main.U[int]) prog.go:18
- Install dl
$ dl init .
- Just commit
delog
is used in the file.
$ cat main.go
package main
import (
"os"
"github.com/task4233/dl/v2"
)
type U[T any] []T
func (t U[T]) append(v T) {
t = append(t, v)
// debug
dl.Info(t)
}
func (t U[T]) change(v T) {
t[0] = v
// debug
dl.FInfo(os.Stdout, t)
}
func main() {
t := U[int]([]int{1, 3})
t.append(5)
t.change(5)
}
- invoke
$ git commit
$ git add main.go
$ git commit -m "feat: add main.go"
remove dl from main.go # automatically removed
[master 975ecf9] feat: add main.go
1 file changed, 12 insertions(+), 21 deletions(-)
rewrite main.go (91%)
delog
is removed automatically
$ git diff HEAD^
diff --git a/main.go b/main.go
index 90a78bd..0e28e8a 100644
--- a/main.go
+++ b/main.go
@@ -0,0 +1,27 @@
+package main
+
+import (
+ "os"
+
+ "github.com/task4233/dl/v2"
+)
+
+type U[T any] []T
+
+func (t U[T]) append(v T) {
+ t = append(t, v)
+ // debug
+
+}
+
+func (t U[T]) change(v T) {
+ t[0] = v
+ // debug
+
+}
+
+func main() {
+ t := U[int]([]int{1, 3})
+ t.append(5)
+ t.change(5)
+}
- removed
delog
codes are restored(not commited)
$ cat main.go
package main
import (
"os"
"github.com/task4233/dl/v2"
)
type U[T any] []T
func (t U[T]) append(v T) {
t = append(t, v)
// debug
dl.Info(t)
}
func (t U[T]) change(v T) {
t[0] = v
// debug
dl.FInfo(os.Stdout, t)
}
func main() {
t := U[int]([]int{1, 3})
t.append(5)
t.change(5)
}
$ dl remove .
Please feel free to make issues and pull requests.