Go 编译时使用私有仓库

Go 编译时使用私有仓库 建议点击 查看原文 查看最新内容。 原文链接: https://typonotes.com/posts/2025/03/27/go-build-with-private-bitbucket/ 使用私有仓库, 无论如何都需要配置 GOPRIVATE 变量 1 2 export GONOSUMDB=git.example.com # comment this line if GOPROXY isn't set export GOPRIVATE=git.example.com 1. 本地开发 在本地开发的时候, 通常使用 ssh 协议进行权限验证。 例如 clone 时地址如下格式如下 1 2 ssh://[email protected]/ ... https://git.example.com/scm/ ... 则执行如下命令替换验证方式 $ git config --global url.ssh://[email protected]/.insteadOf https://git.example.com/scm/ 2. 容器中个编译 在容器中……

阅读全文

Gorm: 声明模型(1)

Gorm: 声明模型(1) 建议点击 查看原文 查看最新内容。 原文链接: https://typonotes.com/posts/2025/03/17/gorm-model-declaration/ 1. 数组字段 https://gorm.io/zh_CN/docs/models.html 如果表中有 slice 字段, 则需要使用 type 指定类型。 1 2 3 4 5 6 package dao type DemoTable struct { Users []string `gorm:"type:text[]"` // This is a slice of strings IDs []int `gorm:"type:int[]"` // This is a slice of integers } 2. 索引 https://gorm.io/zh_CN/docs/indexes.html 2.1 唯一作引 唯一索引有两种形式, uniqueIndex index:[name],unique : 自定义索引名字 1 2 3 4 5 type User struct { Name string `gorm:"index"` // 索引 Name4 string `gorm:"uniqueIndex"` // 唯一索引……

阅读全文

AI 加强版的命令行客户端

AI 加强版的命令行客户端 建议点击 查看原文 查看最新内容。 原文链接: https://typonotes.com/posts/2025/03/04/ai-powered-terminals/ 都 2025 年了, 谁还没有一个 AI 加强版的命令行客户端。 1. 神器 Warp warp 算的上一款真正意义上的 AI 客户端了, 可以直接通过 自然语言 (甚至不用关键字切换)处理工作。 除此外, 还能根据需求 推荐相关命令, 并执行, 还支持 输出结果的上下文分析, 直接……

阅读全文

Typescript NPM 制包/发包问题解析

Typescript NPM 制包/发包问题解析 建议点击 查看原文 查看最新内容。 原文链接: https://typonotes.com/posts/2025/03/01/intro-of-npm-package-publish/ NPM 发包 npm 发包必须要注册一个 npm registry 的账号。 包名全局唯一 访问 https://www.npmjs.com/ 并注册一个账号 本地登录 1 $ npm login 发布 1 $ npm publsh 包的定义 在 package.json 中管理 包的定义 1 2 3 4 5 6 7 8 9 10 11 { "name": "ioredis-client", // 包名 "version": "1.0.7", // 版本 "main": "dist/index.js", // 默认入口文件。 指定后, 可以直接使用包名。 "types":……

阅读全文

(6) 静态前端网站容器化 - 【源码解读】 使用 gin FS 模式为什么无限 301 重定向了?

(6) 静态前端网站容器化 - 【源码解读】 使用 gin FS 模式为什么无限 301 重定向了? 建议点击 查看原文 查看最新内容。 原文链接: https://typonotes.com/posts/2025/02/09/gin-static-fs-301-redirect/ 为了解决 BrowserRouter 模式下的, History API Fallback 问题。 我们在后端服务器做了一些兼容配置。 (4) 静态前端容器化 - 单页面应用(SAP) History API Fallback - 刷新 404 但是由于 gin 对于 StaticFS() 和 FileFromFS() 两个方法的实现问题, 造成了无限 301……

阅读全文

(5) 静态前端网站容器化 - 容器篇 - 自定义 HTTP Server

(5) 静态前端网站容器化 - 容器篇 - 自定义 HTTP Server 建议点击 查看原文 查看最新内容。 原文链接: https://typonotes.com/posts/2025/02/09/static-sap-dockerize-customize-httpserve/ 众所周知, 我们在容器化 静态网站 的时候为了实现 一次编译, 处处运行 的目标, 在 index.html 中插入了一个变量 __CONFIG__, 在启动的时候进行替换为正式后端的地址。 可以参考 (2) Vue3 / React 静态网站项目容器化 - 实战案例 (3) 静……

阅读全文

(4) 静态前端容器化 - 单页面应用(SAP) History API Fallback - 刷新 404

(4) 静态前端容器化 - 单页面应用(SAP) History API Fallback - 刷新 404 建议点击 查看原文 查看最新内容。 原文链接: https://typonotes.com/posts/2025/02/09/static-sap-history-api-fallback-issue/ 当单页面(SAP)页面使用了路由之后(例如 React-Router), 刷新页面就可能造成 404 问题。 问题主要原因是出在 BrowserRouter, 例如 地址 http://localhost:3000/login BrowserRouter 依赖于浏览器的 History API 来管理路由。例……

阅读全文

(3) 静态前端网站容器化 - 容器篇

(3) 静态前端网站容器化 - 容器篇 建议点击 查看原文 查看最新内容。 原文链接: https://typonotes.com/posts/2024/12/16/static-website-container-image/ 相关连接 (1) 静态前端网站容器化 - 理论篇 (2) Vue3 / React 静态网站项目容器化 - 实战案例 对于容器的选择, 其实没什么多数说的, 普通的 nginx 就可以了, 或者类似 caddy 这些都行。 如果由于某些权限问题, 选择了 nginxinc/nginx-unprivileged - docker-hub 则需要注意, /usr/share/nginx/html 权限归于 root 启动用……

阅读全文

Python: VsCode 中指定执行版本

Python Select Interpreter in Vscode 建议点击 查看原文 查看最新内容。 原文链接: https://typonotes.com/posts/2024/12/02/python-select-interpreter-in-vscode/ python 中提供了两种方式执行运行版本 选择默认 Python 版本 Mac Command + Shift + P -> Python: Select Interpreter 配置默认版本 打开 settings.json 1 "python.defaultInterpreterPath": "/usr/bin/python3", 或在 settings 中搜索 python default Interpreter Path 创建虚拟环境 .venv 或 .conda Mac Command + Shift + P -> Python: Create Environment 选择 .venv 或 .conda 管理虚拟环境 更多参考 VsCode 官方文档 Create Environment……

阅读全文

Python: 关于 Package 和 Module 快速入门

Python: 关于 Package 和 Module 快速入门 建议点击 查看原文 查看最新内容。 原文链接: https://typonotes.com/posts/2024/11/29/python-package-module-quick-start/ 什么是 包 (Package) 如果一个目录中有 __init__.py , 那这个目录就是 包 Package 什么是 模块 (Module) xxx.py 文件就是模块 怎么引用自定义包 把 包路径 使用 sys.path.append(xxx) 添加后, 就可以使用 1 2 3 4 5 6 7 8 9 10 11 # import {Package} from x.Package import Module print(f"Module.Attribute") from x.Package.Module import Attribute print(f"{Attribute}") # 别名 from x.Package.Module import Attribute as attr print(f"{attr}") 不能使用 连续的 . 结构 1 2 import x.Package……

阅读全文

福利派送

  • (免费星球)「运维成长路线」

  • 又拍云免费 CDN

最近文章

分类

标签

其它