Hi 👋 我是普润, 这是我这几年一直在使用的昵称或者花名。
我目前主要使用的编程语言是JavaScript
, Golang
是我平时用的第二编程语言。我是一个唯心主义的互联网软件技术开发者, 我对一个优秀的开发者的定义是: 能写出优秀的开发文档以及函数注释。
- 💬左边有我的邮箱联系方式
- purunvision#gmail.com
hàn zì pīn yīn for Golang
License: MIT License
Hi 👋 我是普润, 这是我这几年一直在使用的昵称或者花名。
我目前主要使用的编程语言是JavaScript
, Golang
是我平时用的第二编程语言。我是一个唯心主义的互联网软件技术开发者, 我对一个优秀的开发者的定义是: 能写出优秀的开发文档以及函数注释。
panic: runtime error: index out of range
goroutine 1 [running]:
panic(0x4357560, 0xc42000c100)
/usr/local/Cellar/go/1.7.5/libexec/src/runtime/panic.go:500 +0x1a1
github.com/struCoder/Go-pinyin.normalStr(0x437627f, 0x3, 0x4373156, 0x1)
/Users/wings/Go/src/github.com/struCoder/Go-pinyin/tools.go:81 +0x15e
github.com/struCoder/Go-pinyin.(*options).perStr(0xc4207edef0, 0x437627f, 0x8, 0x3, 0x3)
/Users/wings/Go/src/github.com/struCoder/Go-pinyin/convert.go:28 +0x194
github.com/struCoder/Go-pinyin.(*options).doConvert(0xc4207edef0, 0x4373699, 0x3, 0x4454da8, 0x0, 0x0)
/Users/wings/Go/src/github.com/struCoder/Go-pinyin/convert.go:53 +0x265
github.com/struCoder/Go-pinyin.(*options).Convert(0xc4207edef0, 0x4373699, 0x3, 0x0, 0x434e160, 0x30d40)
/Users/wings/Go/src/github.com/struCoder/Go-pinyin/convert.go:81 +0x4d8
main.main()
/Users/wings/Desktop/goNote/test/pinyin.go:12 +0x77
代码如下:
func main() {
str := "呗"
py := pinyingo.NewPy(pinyingo.STYLE_NORMAL, pinyingo.NO_SEGMENT)
pin := py.Convert(str)
fmt.Println(pin, len(pin))
}
编译很慢是什么原因?
不知道为什么需要安装 gcc,我装了mingw,然后出现下面的错误。目前无法使用
GOROOT=C:\Go #gosetup
GOPATH=D:\project\goProject;C:\Users\Administrator\go #gosetup
C:\Go\bin\go.exe build -o D:\project\goProject\IoTBackendV2\debug\go_build_IoTBackendV2.exe -gcflags "all=-N -l" IoTBackendV2 #gosetup
In file included from ..\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Unicode.hpp:9,
from ..\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/DictTrie.hpp:15,
from ..\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/QuerySegment.hpp:8,
from ..\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Jieba.hpp:4,
from jieba.cpp:5:
..\pkg\mod\github.com\yanyiwu\[email protected]\deps/limonp/LocalVector.hpp: In instantiation of 'void limonp::LocalVector::reserve(size_t) [with T = std::pair<long long unsigned int, const cppjieba::DictUnit*>; size_t = long long unsigned int]':
..\pkg\mod\github.com\yanyiwu\[email protected]\deps/limonp/LocalVector.hpp:83:7: required from 'void limonp::LocalVector::push_back(const T&) [with T = std::pair<long long unsigned int, const cppjieba::DictUnit*>]'
..\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Trie.hpp:99:81: required from here
..\pkg\mod\github.com\yanyiwu\[email protected]\deps/limonp/LocalVector.hpp:95:11: warning: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'struct std::pair<long long unsigned int, const cppjieba::DictUnit*>' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
memcpy(ptr_, old, sizeof(T) * capacity_);
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/utility:70,
from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/algorithm:60,
from ..\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/QuerySegment.hpp:4,
from ..\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Jieba.hpp:4,
from jieba.cpp:5:
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_pair.h:198:12: note: 'struct std::pair<long long unsigned int, const cppjieba::DictUnit*>' declared here
struct pair
^~~~
In file included from ..\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Unicode.hpp:9,
from ..\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/DictTrie.hpp:15,
from ..\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/QuerySegment.hpp:8,
from ..\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Jieba.hpp:4,
from jieba.cpp:5:
..\pkg\mod\github.com\yanyiwu\[email protected]\deps/limonp/LocalVector.hpp: In instantiation of 'limonp::LocalVector& limonp::LocalVector::operator=(const limonp::LocalVector&) [with T = std::pair<long long unsigned int, const cppjieba::DictUnit*>]':
..\pkg\mod\github.com\yanyiwu\[email protected]\deps/limonp/LocalVector.hpp:33:11: required from 'limonp::LocalVector::LocalVector(const limonp::LocalVector&) [with T = std::pair<long long unsigned int, const cppjieba::DictUnit*>]'
..\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Trie.hpp:28:8: required from 'void std::_Construct(_T1*, _Args&& ...) [with _T1 = cppjieba::Dag; _Args = {const cppjieba::Dag&}]'
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_uninitialized.h:83:18: required from 'static _ForwardIterator std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = const cppjieba::Dag*; _ForwardIterator = cppjieba::Dag*; bool _TrivialValueTypes = false]'
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_uninitialized.h:134:15: required from '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = const cppjieba::Dag*; _ForwardIterator = cppjieba::Dag*]'
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_uninitialized.h:289:37: required from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = const cppjieba::Dag*; _ForwardIterator = cppjieba::Dag*; _Tp = cppjieba::Dag]'
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_uninitialized.h:311:2: required from '_ForwardIterator std::__uninitialized_move_if_noexcept_a(_InputIterator, _InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = cppjieba::Dag*; _ForwardIterator = cppjieba::Dag*; _Allocator = std::allocatorcppjieba::Dag]'
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/vector.tcc:611:7: required from 'void std::vector<_Tp, _Alloc>::_M_default_append(std::vector<_Tp, _Alloc>::size_type) [with _Tp = cppjieba::Dag; _Alloc = std::allocatorcppjieba::Dag; std::vector<_Tp, _Alloc>::size_type = long long unsigned int]'
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_vector.h:827:4: required from 'void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = cppjieba::Dag; _Alloc = std::allocatorcppjieba::Dag; std::vector<Tp, Alloc>::size_type = long long unsigned int]'
..\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Trie.hpp:86:27: required from here
..\pkg\mod\github.com\yanyiwu\[email protected]\deps/limonp/LocalVector.hpp:63:13: warning: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'struct std::pair<long long unsigned int, const cppjieba::DictUnit*>' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
memcpy(ptr, vec.ptr, vec.size() * sizeof(T));
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/utility:70,
from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/algorithm:60,
from ..\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/QuerySegment.hpp:4,
from ..\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Jieba.hpp:4,
from jieba.cpp:5:
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_pair.h:198:12: note: 'struct std::pair<long long unsigned int, const cppjieba::DictUnit*>' declared here
struct pair
^~~~
runtime: VirtualAlloc of 245760 bytes failed with errno=1455
fatal error: out of memory
runtime stack:
runtime.throw(0xe5d4f5, 0xd)
c:/go/src/runtime/panic.go:774 +0x79
runtime.sysUsed(0xc9d6e5e000, 0x3c000)
c:/go/src/runtime/mem_windows.go:83 +0x230
runtime.(*mheap).allocSpanLocked(0x15c58c0, 0x1e, 0x15ee128, 0x20321a600000000)
c:/go/src/runtime/mheap.go:1221 +0x203
runtime.(*mheap).alloc_m(0x15c58c0, 0x1e, 0x101, 0x6c6effff)
c:/go/src/runtime/mheap.go:1015 +0xd0
runtime.(*mheap).alloc.func1()
c:/go/src/runtime/mheap.go:1086 +0x53
runtime.(*mheap).alloc(0x15c58c0, 0x1e, 0x6c000101, 0x6b919460)
c:/go/src/runtime/mheap.go:1085 +0x91
runtime.largeAlloc(0x3c000, 0x73620100, 0x6b919460)
c:/go/src/runtime/malloc.go:1138 +0x9e
runtime.mallocgc.func1()
c:/go/src/runtime/malloc.go:1033 +0x4d
runtime.systemstack(0x0)
c:/go/src/runtime/asm_amd64.s:370 +0x6b
runtime.mstart()
c:/go/src/runtime/proc.go:1146
goroutine 14 [running]:
runtime.systemstack_switch()
c:/go/src/runtime/asm_amd64.s:330 fp=0xc106ab1a70 sp=0xc106ab1a68 pc=0x45be80
runtime.mallocgc(0x3c000, 0x0, 0x26000, 0xc86985a000)
c:/go/src/runtime/malloc.go:1032 +0x8d4 fp=0xc106ab1b10 sp=0xc106ab1a70 pc=0x40c894
runtime.growslice(0xe01720, 0xc86985a000, 0x6000, 0x6000, 0x6001, 0xc86985a000, 0x4c00, 0x6000)
c:/go/src/runtime/slice.go:175 +0x155 fp=0xc106ab1b78 sp=0xc106ab1b10 pc=0x4449f5
cmd/compile/internal/ssa.(*desiredState).add(0xc0181b73e0, 0x99f17)
c:/go/src/cmd/compile/internal/ssa/regalloc.go:2575 +0x18b fp=0xc106ab1be0 sp=0xc106ab1b78 pc=0x67414b
cmd/compile/internal/ssa.(*desiredState).addList(0xc0181b73e0, 0xffffff0000099f17)
c:/go/src/cmd/compile/internal/ssa/regalloc.go:2583 +0x5c fp=0xc106ab1c08 sp=0xc106ab1be0 pc=0x6741ec
cmd/compile/internal/ssa.(*desiredState).merge(0xc0181b73e0, 0xc106ab1f20)
c:/go/src/cmd/compile/internal/ssa/regalloc.go:2638 +0x84 fp=0xc106ab1c50 sp=0xc106ab1c08 pc=0x674484
cmd/compile/internal/ssa.(*regAllocState).computeLive(0xc000039980)
c:/go/src/cmd/compile/internal/ssa/regalloc.go:2436 +0x1594 fp=0xc106ab1ff8 sp=0xc106ab1c50 pc=0x672f44
cmd/compile/internal/ssa.(*regAllocState).init(0xc000039980, 0xc0038d0580)
c:/go/src/cmd/compile/internal/ssa/regalloc.go:674 +0x6c8 fp=0xc106ab2140 sp=0xc106ab1ff8 pc=0x663be8
cmd/compile/internal/ssa.regalloc(0xc0038d0580)
c:/go/src/cmd/compile/internal/ssa/regalloc.go:145 +0x51 fp=0xc106ab2168 sp=0xc106ab2140 pc=0x6616e1
cmd/compile/internal/ssa.Compile(0xc0038d0580)
c:/go/src/cmd/compile/internal/ssa/compile.go:92 +0x99b fp=0xc106ab5d08 sp=0xc106ab2168 pc=0x617b9b
cmd/compile/internal/gc.buildssa(0xc0002b2f20, 0x3, 0x0)
c:/go/src/cmd/compile/internal/gc/ssa.go:289 +0xc15 fp=0xc106ab5eb0 sp=0xc106ab5d08 pc=0xcc2325
cmd/compile/internal/gc.compileSSA(0xc0002b2f20, 0x3)
c:/go/src/cmd/compile/internal/gc/pgen.go:298 +0x54 fp=0xc106ab5f98 sp=0xc106ab5eb0 pc=0xc8c984
cmd/compile/internal/gc.compileFunctions.func2(0xc0038d9860, 0xc003d7aa40, 0x3)
c:/go/src/cmd/compile/internal/gc/pgen.go:363 +0x50 fp=0xc106ab5fc8 sp=0xc106ab5f98 pc=0xd4f8e0
runtime.goexit()
c:/go/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc106ab5fd0 sp=0xc106ab5fc8 pc=0x45de61
created by cmd/compile/internal/gc.compileFunctions
c:/go/src/cmd/compile/internal/gc/pgen.go:361 +0x12f
goroutine 1 [semacquire, 52 minutes]:
sync.runtime_Semacquire(0xc003d7aa48)
c:/go/src/runtime/sema.go:56 +0x49
sync.(*WaitGroup).Wait(0xc003d7aa40)
c:/go/src/sync/waitgroup.go:130 +0x6b
cmd/compile/internal/gc.compileFunctions()
c:/go/src/cmd/compile/internal/gc/pgen.go:373 +0x1d5
cmd/compile/internal/gc.Main(0xe7c0f8)
c:/go/src/cmd/compile/internal/gc/main.go:695 +0x32b7
main.main()
c:/go/src/cmd/compile/main.go:51 +0xb3
Compilation finished with exit code 2
[zhòng yáng jié]
pinyingo.NewPy(pinyingo.STYLE_INITIALS, pinyingo.USE_SEGMENT) 只显示 [ch ]
pinyingo.NewPy(pinyingo.STYLE_FIRST_LETTER, pinyingo.USE_SEGMENT) 则为 [ ]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.