vscode markdown
# your tag
```sql
CREATE TABLE `customers` (
`id` bigint NOT NULL COMMENT '客户 id 关联',
`created_at` datetime(3) NOT NULL,
`updated_at` datetime(3) NOT NULL,
`deleted_at` bigint NOT NULL DEFAULT '0',
`customer_service` bigint NOT NULL DEFAULT '0',
`customers_business_apply_id` bigint NOT NULL DEFAULT '0',
`delay_apply_id` bigint NOT NULL DEFAULT '0',
`customers_service_modify_id` bigint NOT NULL DEFAULT '0',
`company_type` varchar(4) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='客户基础信息';
```
快捷键是这个家伙
{
"key": "shift+cmd+o",
"command": "workbench.action.gotoSymbol"
}
这样你就能快速转跳到对应标签了
这个类似的做法,你指定用户试试 user, err := user.Lookup("you user name")
```go
c.clientCmd = exec.Command(name, args...)
// c.clientCmd.Stdin = os.Stdin
// c.clientCmd.Stdout = os.Stdout
// c.clientCmd.Stderr = os.Stderr
// c.clientCmd = exec.Command("sh")
fmt.Println(c.clientCmd.String())
var err error
user, err := user.Lookup("you user name")
if err != nil {
fmt.Println(err, "invalid user", name)
return
}
// var ids_s, _ = user.GroupIds()
// ids := make([]uint32, len(ids_s), len(ids_s))
// for k, _ := range ids_s {
// s, _ := strconv.Atoi(ids_s[k])
// ids[k] = uint32(s)
// }
// 获取用户 id
uid, err := strconv.ParseUint(user.Uid, 10, 32)
if err != nil {
fmt.Println(err)
}
// 获取用户组 id
gid, err := strconv.ParseUint(user.Gid, 10, 32)
if err != nil {
fmt.Println(err)
}
c.clientCmd.SysProcAttr = &syscall.SysProcAttr{
// Cloneflags: syscall.CLONE_NEWUTS |
// syscall.CLONE_NEWIPC |
// syscall.CLONE_NEWPID |
// syscall.CLONE_NEWNS |
// syscall.CLONE_NEWUSER |
// syscall.CLONE_NEWNET,
Pdeathsig: syscall.SIGKILL, // linux 下退出后杀死子孙进程 或者设置 {Setpgid: false}
}
//设置进程执行用户
c.clientCmd.SysProcAttr.Credential = &syscall.Credential{
Uid: uint32(uid),
Gid: uint32(gid),
}
// c.read()
time.Sleep(time.Second * 2)
fmt.Println("xxxx")
err = c.clientCmd.Start()
if err != nil {
fmt.Printf("error start: -> %s ", err.Error())
return
}
err = c.clientCmd.Wait()
if err != nil {
fmt.Printf("error wait: -> %s ", err.Error())
return
}
```