我想将我创建的模块导入到另一个项目中。源代码位于 GitHub 的公共存储库中,但在尝试导入 GoLand 时出现以下错误:
go: finding module for package github.com/ambye85/gophercises/link
go: downloading github.com/ambye85/gophercises/link v0.0.0-20200323082040-d484a876f7e8
go: downloading github.com/ambye85/gophercises v0.0.0-20200323082040-d484a876f7e8
github.com/ambye85/gophercises/sitemap imports
github.com/ambye85/gophercises/link: github.com/ambye85/gophercises/link@v0.0.0-20200323082040-d484a876f7e8: verifying module: github.com/ambye85/gophercises/link@v0.0.0-20200323082040-d484a876f7e8: reading https://sum.golang.org/lookup/github.com/ambye85/gophercises/link@v0.0.0-20200323082040-d484a876f7e8: 410 Gone
server response:
not found: github.com/ambye85/gophercises/link@v0.0.0-20200323082040-d484a876f7e8: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /tmp/gopath/pkg/mod/cache/vcs/a488fe783593bd6e7b765f40dfed37c7e534d0a80ca8e1bff63e11e21f02e8fd: exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
Run Code Online (Sandbox Code Playgroud)
我所做的所有搜索似乎都表明这是由于尝试访问私人存储库引起的。这里情况不同。
有谁知道原因和解决方法是什么?
输出go env:
go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ashleyb/Library/Caches/go-build"
GOENV="/Users/ashleyb/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin" …Run Code Online (Sandbox Code Playgroud) 我在 VS Code 中有一些自定义任务,我想在多个项目中共享它们。这些任务当前安装在$PROJECT_DIR/.vscode/tasks.json.
我应该将任务文件放在哪里,以便 VS Code 为所有项目加载它(我正在考虑类似于用户与工作空间设置的内容)?
我已经尝试过~/.vscode/tasks.json(我不确定这是否是 VS Code 使用的位置,或者它是否是我很久以前创建的位置)以及$HOME/Library/Application \Support/Code/User/tasks.json(这是存储自定义等的位置)settings.json。keybindings.json这两个位置都不起作用。
目前,我似乎只能在每个工作区而不是全局定义自定义任务。我在官方文档中看不到任何内容。欢迎任何指点吗?
我一直在研究Reactive Programming with RxJava一书中的例子,它针对版本 1 而不是 2。无限流的介绍有以下示例(并注意有更好的方法来处理并发):
Observable<BigInteger> naturalNumbers = Observable.create(subscriber -> {
Runnabler = () -> {
BigInteger i = ZERO;
while (!subscriber.isUnsubscribed()) {
subscriber.onNext(i);
i = i.add(ONE);
}
};
new Thread(r).start();
});
...
Subscription subscription = naturalNumbers.subscribe(x -> log(x));
/* after some time... */
subscription.unsubscribe();
Run Code Online (Sandbox Code Playgroud)
但是,在 RxJava 2 中,传递给create()方法的 lambda 表达式是类型的,ObservableEmitter并且它没有isUnsubscribed()方法。我查看了2.0 中的不同之处,还搜索了存储库,但找不到任何此类方法。
如何在 2.0 中实现相同的功能?
编辑以包含如下给出的解决方案(nb 使用 kotlin):
val naturalNumbers = Observable.create<BigInteger> { emitter ->
Thread({
var int: …Run Code Online (Sandbox Code Playgroud) 我已经per_class为使用JUnit5的项目设置了默认的测试生命周期。这是在junit-platform.properties文件中完成的。但是,由于应用了此配置,因此在我的测试运行之前,现在有很多日志输出:
Dec 06, 2018 8:15:22 PM org.junit.platform.launcher.core.LauncherConfigurationParameters fromClasspathResource
INFO: Loading JUnit Platform configuration parameters from classpath resource [file:/Users/amb85/Projects/kotlin/katas/out/test/resources/junit-platform.properties].
Dec 06, 2018 8:15:22 PM org.junit.jupiter.engine.descriptor.TestInstanceLifecycleUtils getDefaultTestInstanceLifecycle
INFO: Using default test instance lifecycle mode 'PER_CLASS' set via the 'junit.jupiter.testinstance.lifecycle.default' configuration parameter.
Run Code Online (Sandbox Code Playgroud)
我不想看到这些日志消息。如何禁用它们或将日志级别设置得更高?
我有一个启动配置,它运行 bat 脚本作为预启动任务。有时,bat 脚本无法构建我的项目。然而,调试任务仍然在运行,这确实很烦人,这意味着我必须在终端的输出更改为调试控制台之前密切关注终端的输出。
如果预启动任务失败,如何防止启动配置继续?
我在 Kotlin 中编写了一个 vertx 服务接口,我正在尝试为其生成服务代理。但是,除了在 中生成generated目录之外src/main,它什么都不做。
src/main/java/amb85/portfolio/package-info.java:
@ModuleGen(name = "portfolio", groupPackage = "amb85.portfolio")
package amb85.portfolio;
import io.vertx.codegen.annotations.ModuleGen;
Run Code Online (Sandbox Code Playgroud)
然后我有以下服务接口src/main/kotlin/amb85/portfolio/PortfolioService.kt:
@VertxGen
@ProxyGen
interface PortfolioService {
companion object {
val ADDRESS = "service.portfolio"
val EVENT_ADDRESS = "portfolio"
}
fun getPortfolio(resultHandler: (AsyncResult<Portfolio>) -> Unit)
fun buy(amount: Int, quote: JsonObject, resultHandler: (AsyncResult<Portfolio>) -> Unit)
fun sell(amount: Int, quote:JsonObject, resultHandler: (AsyncResult<Portfolio>) -> Unit)
fun evaluate(resultHandler: (AsyncResult<Double>) -> Unit)
}
Run Code Online (Sandbox Code Playgroud)
以及相关配置来自build.gradle:
task generateProxies(type: JavaCompile, group: "build",
description: "Generates …Run Code Online (Sandbox Code Playgroud) send()以下示例中的函数以递归方式调用自身:
internal inner class RouteSender(
val features: List<Feature>,
val exchange: GrpcUniExchange<Point, RouteSummary>
) {
var result: AsyncResult<RouteSummary>? = null // Set in stub for recordRoute.
fun send(numPoints: Int) {
result?.let {
// RPC completed or err'd before sending completed.
// Sending further requests won't error, but they will be thrown away.
return
}
val index = random.nextInt(features.size)
val point = features[index].location
println("Visiting point ${RouteGuideUtil.getLatitude(point)}, " +
"${RouteGuideUtil.getLongitude(point)}")
exchange.write(point)
if (numPoints > 0) {
vertx.setTimer(random.nextInt(1000) + 500L) { _ -> …Run Code Online (Sandbox Code Playgroud) kotlin ×2
vscode-tasks ×2
go ×1
go-modules ×1
goland ×1
junit5 ×1
rx-java ×1
rx-java2 ×1
rx-kotlin ×1
vert.x ×1