我用这个创建了一个 go 模块:
go mod init rtws
vim main.go # pasted a bunch of code from an example
go mod tidy
Run Code Online (Sandbox Code Playgroud)
这两个文件都导入“github.com/gorilla/websocket”,所以当我使用时,tidy我期望它会下载该依赖项,但我收到以下警告:
go: warning: "all" matched no packages
随后尝试运行它时抱怨依赖项不存在。
这个错误是什么意思?
编辑:在搜索时,我发现的最相关的事情是SO 上的另一个问题。很多人在运行其他命令时都会出现此警告,但他们的解决方案不适用于这种特定情况。
这是第二版Rust教程中的一行:
let mut f = File::open(filename).expect("file not found");
Run Code Online (Sandbox Code Playgroud)
我假设文件描述符是一个基本上不会改变并且是只读的数字的包装器.
编译器抱怨文件不能被可变地借用,我假设它是因为该方法read_to_string将实例作为self参数作为可变,但问题是"为什么"?关于文件描述符有什么变化?是跟踪光标位置还是什么?
error[E0596]: cannot borrow immutable local variable `fdesc` as mutable
--> main.rs:13:5
|
11 | let fdesc = File::open(fname).expect("file not found");
| ----- consider changing this to `mut fdesc`
12 | let mut fdata = String::new();
13 | fdesc.read_to_string(&mut fdata)
| ^^^^^ cannot borrow mutably
Run Code Online (Sandbox Code Playgroud)
整个来源:
fn main() {
let args: Vec<String> = env::args().collect();
let query = &args[1];
let fname = &args[2];
println!("Searching …Run Code Online (Sandbox Code Playgroud) 我试图跟踪自己的工作时间,并且必须保持非常具体的详细信息,说明正在编辑哪些文件以及何时编辑。在我的.vimrc脚本中,我有:
:silent !clock_in_script.sh %:p
Run Code Online (Sandbox Code Playgroud)
这个clock_in_script.sh将文件的位置作为参数,并将文件的名称和时间写入日志。
退出vim时,有没有办法类似地调用脚本?如果没有,有什么办法可以将我正在编辑的文件的名称以及时间从vim写入日志文件?
先感谢您!
作为学习练习,我为x86 bios系统编写了一个16位的引导程序。它在QEMU上似乎运行良好。我将其添加到用于旧式amd-turion计算机(x86_64)的驱动器上,当我尝试引导该计算机时,它将进入BIOS屏幕,然后黑屏上的光标闪烁。
我的问题是,QEMU的x86仿真器和绝对使用BIOS而不是UEFI的真实x86(64位)计算机之间可能有什么区别?我是否需要针对实际计算机而不是QEMU编写代码?是我将信息复制到驱动器的方式吗?计算机是否采用了某些硬件级别的安全性规定?
我知道它在VirtualBox上也不起作用。
看来加载第二阶段是有问题的(通过在真实硬件上成功地打印第一阶段的字符)。
我的第一阶段引导程序使用以下文件中的代码:
stage_one.asm
[bits 16]
[org 0x7c00]
LOAD_ADDR: equ 0x9000 ; This is where I'm loading the 2nd stage in RAM.
start:
xor ax, ax ; nullify ax so we can set
mov ds, ax ; ds to 0
mov sp, bp ; relatively out of the way
mov bp, 0x8000 ; set up the stack
call disk_load ; load the new instructions
; at …Run Code Online (Sandbox Code Playgroud) 我的.inputrclinux盒子上的我和我的macbook pro上运行Yosemite完全相同:
Control-n: menu-complete
Control-p: menu-complete-backward
Run Code Online (Sandbox Code Playgroud)
在Linux上,它完美无瑕; 但是,在我的macbook pro上,只能Control-n工作,但Control-p不会向后循环或做任何事情.事实上,menu-complete-backward当我编辑时,甚至没有突出显示为正确的语法inputrc.这是达尔文的事情,还是我错过了什么?
bash ×2
bare-metal ×1
bootloader ×1
file ×1
go ×1
go-modules ×1
immutability ×1
linux ×1
macos ×1
nasm ×1
package ×1
qemu ×1
readline ×1
real-mode ×1
rust ×1
vim ×1