在编译子函数时报错:
D:\myprojects\sorter\src>go build algorithms/qsort
can't load package: package algorithms/qsort: cannot find package "algorithms/qsort" in any of:
C:\Go\src\algorithms\qsort (from $GOROOT)
D:\myprojects\sorter\src\algorithms\qsort (from $GOPATH)
环境变量:D:\myprojects\sorter\src>echo %GOPATH% --> D:\myprojects\sorter;
目录结构:![ml.jpg](https://static.studygolang.com/210313/5f236a330e8fe9b9f7009e2b42897649.jpg)
我的源码:
package qsort
func quickSort(values []int, left, right int) {
temp := values[left]
p := left
i, j := left, right
for i <= j {
for j >= p && values[j] >= temp {
j--
}
if j >= p {
values[p] = values[j]
p = j
}
if values[i] <= temp && i <= p {
i++
}
if i <= p {
values[p] = values[i]
p = i
}
}
values[p] = temp
if p-left > 1 {
quickSort(values, left, p-1)
}
if right-p > 1 {
quickSort(values, p+1, right)
}
}
func QuickSort(values []int) {
quickSort(values, 0, len(values)-1)
}
请大家指点,感谢!
新手求助:go build时提示can't load package: package algorithms/qsort: cannot find package "algorithms/qsort" in any of:
gary_gan · · 1470 次点击更多评论