1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

upgrade go module v2

This commit is contained in:
dudaodong
2022-03-17 10:57:35 +08:00
parent 1434e00712
commit 50c6e51393
42 changed files with 46 additions and 45 deletions

View File

@@ -3,7 +3,7 @@ package algorithm
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestLRUCache(t *testing.T) { func TestLRUCache(t *testing.T) {

View File

@@ -4,7 +4,7 @@
// Package algorithm contain some basic algorithm functions. eg. sort, search, list, linklist, stack, queue, tree, graph. TODO // Package algorithm contain some basic algorithm functions. eg. sort, search, list, linklist, stack, queue, tree, graph. TODO
package algorithm package algorithm
import "github.com/duke-git/lancet/lancetconstraints" import "github.com/duke-git/lancet/v2/lancetconstraints"
// Search algorithms see https://github.com/TheAlgorithms/Go/tree/master/search // Search algorithms see https://github.com/TheAlgorithms/Go/tree/master/search

View File

@@ -3,7 +3,7 @@ package algorithm
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
var sortedNumbers = []int{1, 2, 3, 4, 5, 6, 7, 8} var sortedNumbers = []int{1, 2, 3, 4, 5, 6, 7, 8}

View File

@@ -4,7 +4,7 @@
// Package algorithm contain some basic algorithm functions. eg. sort, search // Package algorithm contain some basic algorithm functions. eg. sort, search
package algorithm package algorithm
import "github.com/duke-git/lancet/lancetconstraints" import "github.com/duke-git/lancet/v2/lancetconstraints"
// BubbleSort use bubble to sort slice. // BubbleSort use bubble to sort slice.
func BubbleSort[T any](slice []T, comparator lancetconstraints.Comparator) []T { func BubbleSort[T any](slice []T, comparator lancetconstraints.Comparator) []T {

View File

@@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
// People test mock data // People test mock data
@@ -16,7 +16,7 @@ type people struct {
// PeopleAageComparator sort people slice by age field // PeopleAageComparator sort people slice by age field
type peopleAgeComparator struct{} type peopleAgeComparator struct{}
// Compare implements github.com/duke-git/lancet/lancetconstraints/constraints.go/Comparator // Compare implements github.com/duke-git/lancet/v2/lancetconstraints/constraints.go/Comparator
func (pc *peopleAgeComparator) Compare(v1 any, v2 any) int { func (pc *peopleAgeComparator) Compare(v1 any, v2 any) int {
p1, _ := v1.(people) p1, _ := v1.(people)
p2, _ := v2.(people) p2, _ := v2.(people)

View File

@@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestToChar(t *testing.T) { func TestToChar(t *testing.T) {

View File

@@ -3,7 +3,7 @@ package cryptor
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestAesEcbEncrypt(t *testing.T) { func TestAesEcbEncrypt(t *testing.T) {

View File

@@ -3,7 +3,7 @@ package cryptor
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestBase64StdEncode(t *testing.T) { func TestBase64StdEncode(t *testing.T) {

View File

@@ -3,7 +3,7 @@ package cryptor
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestDesEcbEncrypt(t *testing.T) { func TestDesEcbEncrypt(t *testing.T) {

View File

@@ -3,7 +3,7 @@ package cryptor
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestRsaEncrypt(t *testing.T) { func TestRsaEncrypt(t *testing.T) {

View File

@@ -4,7 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/duke-git/lancet/datastructure" "github.com/duke-git/lancet/v2/datastructure"
) )
// DoublyLink is a linked list. Whose node has a generic Value, Pre pointer points to a previous node of the link, Next pointer points to a next node of the link. // DoublyLink is a linked list. Whose node has a generic Value, Pre pointer points to a previous node of the link, Next pointer points to a next node of the link.

View File

@@ -3,7 +3,7 @@ package datastructure
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestDoublyLink_InsertAtFirst(t *testing.T) { func TestDoublyLink_InsertAtFirst(t *testing.T) {

View File

@@ -4,7 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/duke-git/lancet/datastructure" "github.com/duke-git/lancet/v2/datastructure"
) )
// SinglyLink is a linked list. Whose node has a Value generics and Next pointer points to a next node of the link. // SinglyLink is a linked list. Whose node has a Value generics and Next pointer points to a next node of the link.

View File

@@ -3,7 +3,7 @@ package datastructure
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestSinglyLink_InsertAtFirst(t *testing.T) { func TestSinglyLink_InsertAtFirst(t *testing.T) {

View File

@@ -3,7 +3,7 @@ package datastructure
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestListData(t *testing.T) { func TestListData(t *testing.T) {

View File

@@ -3,7 +3,7 @@ package datastructure
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestArrayQueue_EnQueue(t *testing.T) { func TestArrayQueue_EnQueue(t *testing.T) {

View File

@@ -3,7 +3,7 @@ package datastructure
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestCircularQueue_EnQueue(t *testing.T) { func TestCircularQueue_EnQueue(t *testing.T) {

View File

@@ -4,7 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/duke-git/lancet/datastructure" "github.com/duke-git/lancet/v2/datastructure"
) )
// LinkedQueue implements queue with link list // LinkedQueue implements queue with link list

View File

@@ -3,7 +3,7 @@ package datastructure
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestLinkedQueue_EnQueue(t *testing.T) { func TestLinkedQueue_EnQueue(t *testing.T) {

View File

@@ -3,7 +3,7 @@ package datastructure
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestSet_Add(t *testing.T) { func TestSet_Add(t *testing.T) {

View File

@@ -3,7 +3,7 @@ package datastructure
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestArrayStack_Push(t *testing.T) { func TestArrayStack_Push(t *testing.T) {

View File

@@ -4,7 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/duke-git/lancet/datastructure" "github.com/duke-git/lancet/v2/datastructure"
) )
// LinkedStack implements stack with link list // LinkedStack implements stack with link list

View File

@@ -3,7 +3,7 @@ package datastructure
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestLinkedStack_Push(t *testing.T) { func TestLinkedStack_Push(t *testing.T) {

View File

@@ -3,8 +3,8 @@ package datastructure
import ( import (
"math" "math"
"github.com/duke-git/lancet/datastructure" "github.com/duke-git/lancet/v2/datastructure"
"github.com/duke-git/lancet/lancetconstraints" "github.com/duke-git/lancet/v2/lancetconstraints"
) )
// BSTree is a binary search tree data structure in which each node has at most two children, // BSTree is a binary search tree data structure in which each node has at most two children,

View File

@@ -3,7 +3,7 @@ package datastructure
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
type intComparator struct{} type intComparator struct{}

View File

@@ -4,8 +4,8 @@ import (
"fmt" "fmt"
"math" "math"
"github.com/duke-git/lancet/datastructure" "github.com/duke-git/lancet/v2/datastructure"
"github.com/duke-git/lancet/lancetconstraints" "github.com/duke-git/lancet/v2/lancetconstraints"
) )
func preOrderTraverse[T any](node *datastructure.TreeNode[T]) []T { func preOrderTraverse[T any](node *datastructure.TreeNode[T]) []T {

View File

@@ -4,7 +4,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestAddDay(t *testing.T) { func TestAddDay(t *testing.T) {

View File

@@ -4,7 +4,7 @@ import (
"os" "os"
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestIsExist(t *testing.T) { func TestIsExist(t *testing.T) {

View File

@@ -3,7 +3,7 @@ package formatter
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestComma(t *testing.T) { func TestComma(t *testing.T) {

View File

@@ -7,7 +7,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestAfter(t *testing.T) { func TestAfter(t *testing.T) {

View File

@@ -3,7 +3,7 @@ package function
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestWatcher(t *testing.T) { func TestWatcher(t *testing.T) {

2
go.mod
View File

@@ -1,3 +1,3 @@
module github.com/duke-git/lancet module github.com/duke-git/lancet/v2
go 1.18 go 1.18

View File

@@ -3,7 +3,7 @@ package mathutil
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestExponent(t *testing.T) { func TestExponent(t *testing.T) {

View File

@@ -6,7 +6,7 @@ import (
"log" "log"
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestHttpGet(t *testing.T) { func TestHttpGet(t *testing.T) {

View File

@@ -4,7 +4,7 @@ import (
"net" "net"
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestGetInternalIp(t *testing.T) { func TestGetInternalIp(t *testing.T) {

View File

@@ -5,7 +5,7 @@ import (
"regexp" "regexp"
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestRandString(t *testing.T) { func TestRandString(t *testing.T) {

View File

@@ -6,7 +6,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestRetryFailed(t *testing.T) { func TestRetryFailed(t *testing.T) {

View File

@@ -3,7 +3,7 @@ package slice
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestContain(t *testing.T) { func TestContain(t *testing.T) {

View File

@@ -3,7 +3,7 @@ package strutil
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestCamelCase(t *testing.T) { func TestCamelCase(t *testing.T) {

View File

@@ -4,7 +4,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestOsDetection(t *testing.T) { func TestOsDetection(t *testing.T) {

View File

@@ -3,7 +3,7 @@ package validator
import ( import (
"testing" "testing"
"github.com/duke-git/lancet/internal" "github.com/duke-git/lancet/v2/internal"
) )
func TestIsAllUpper(t *testing.T) { func TestIsAllUpper(t *testing.T) {

View File

@@ -1,9 +1,10 @@
package xerror package xerror
import ( import (
"github.com/duke-git/lancet/internal"
"strconv" "strconv"
"testing" "testing"
"github.com/duke-git/lancet/v2/internal"
) )
func TestUnwrap(t *testing.T) { func TestUnwrap(t *testing.T) {