Intellij上的Golang插件。(Golang plugin on Intellij. Library and break points)
我在Go上写我的代码。 我在Idea Intellij的Golang插件中构建了我的项目。 我有一个包主。 主要导入不同的包。
import ( "RF" "flag" "io" "net/http" "os" "runtime" "depot" "info" "logger" "logic" "poly" "ranker" "revgeocoder" "search" "search/engine" "stat" "views" "fmt" )
如果我在
$GOPATH
编写路径,这个软件包链接非常好。 在Idea Intellij中,它是这样做的:现在,我想要:
- 建立我的项目没有警告
- 调试我的项目
第一点。 我做了一个“构建”,比我有:“包没有指定”
如果我写封装名称
main
,那么警告不会消失:我可以做什么?
第二点。 大会是成功的。 在我可以调试的那部分包之后,我不能调试另一个包。 例如,我可以调试包
engine
。 这个包的路径:/home/INT.PV.KM/urvanov/hedgehogues/distr/mapsfullsearch/src/search/engine/engine.go
下一个文件我无法调试。
/home/INT.PV.KM/urvanov/hedgehogues/distr/mapsfullsearch/src/search/context.go
我无法在此文件中设置中断点:
请帮我解决我的问题。
I write my code on Go. I build my project in Idea Intellij with plugin for golang. I have a package main. In main import different packages.
import ( "RF" "flag" "io" "net/http" "os" "runtime" "depot" "info" "logger" "logic" "poly" "ranker" "revgeocoder" "search" "search/engine" "stat" "views" "fmt" )
This packages very well linked if I write paths in
$GOPATH
. In Idea Intellij it makes such way:Now, I want:
- Build my project without warning
- Debugging my project
First point. I make a 'build' and than I have: "Package is not specified"
If I write to Package name
main
, than warning doesn't disappear:What I can do?
Point number two. The assembly is successful. After that part of package I can debug, another package I cannot debug. For example package
engine
I can debug. Path to this package:/home/INT.PV.KM/urvanov/hedgehogues/distr/mapsfullsearch/src/search/engine/engine.go
Next file I cannot debug.
/home/INT.PV.KM/urvanov/hedgehogues/distr/mapsfullsearch/src/search/context.go
I cannot set a breaks point in this file:
Please, help me with my problems.
原文:https://stackoverflow.com/questions/41334268
最满意答案
您可以在
loop
函数中调用所有setTimeout
函数。 并使用setInterval
调用此循环函数。 注意:我还更改了代码中的一些颜色更改部分。jsfiddle链接: https ://jsfiddle.net/zgdx5xan/
var red = document.getElementById("circleRed"); var orange = document.getElementById('circleOrange') var green = document.getElementById('circleGreens'); loop(); setInterval(loop,11000); function loop(){ console.log("loop started") setTimeout( function(){ red.style.backgroundColor = "red"; orange.style.backgroundColor = "black"; green.style.backgroundColor = "black"; console.log("red opened") }, 2000); setTimeout(function(){ green.style.backgroundColor = "green"; red.style.backgroundColor = "black"; console.log("green opened") }, 5000); setTimeout(function(){ orange.style.backgroundColor = "orange"; green.style.backgroundColor = "black"; red.style.backgroundColor = "black"; console.log("orange opened") }, 10000); }
#circleRed, #circleGreens, #circleOrange { width: 50px; height: 50px; -webkit-border-radius: 25px; -moz-border-radius: 25px; border-radius: 25px; margin-bottom: 10px; background-color: "black"; } .back{ width: 60px; margin: 10px 0px 10px 20px; padding-left: 10px; padding-top: 10px; padding-bottom: 10px; background-color: black; } body{ margin: 0; }
<div class="back"> <div id="circleRed"> </div> <div id="circleOrange"> </div> <div id="circleGreens"> </div> </div>
You can cal your all
setTimeout
function in aloop
function. And call this loop function withsetInterval
. Note : I also changed some of the color changing sections in your code .jsfiddle link : https://jsfiddle.net/zgdx5xan/
var red = document.getElementById("circleRed"); var orange = document.getElementById('circleOrange') var green = document.getElementById('circleGreens'); loop(); setInterval(loop,11000); function loop(){ console.log("loop started") setTimeout( function(){ red.style.backgroundColor = "red"; orange.style.backgroundColor = "black"; green.style.backgroundColor = "black"; console.log("red opened") }, 2000); setTimeout(function(){ green.style.backgroundColor = "green"; red.style.backgroundColor = "black"; console.log("green opened") }, 5000); setTimeout(function(){ orange.style.backgroundColor = "orange"; green.style.backgroundColor = "black"; red.style.backgroundColor = "black"; console.log("orange opened") }, 10000); }
#circleRed, #circleGreens, #circleOrange { width: 50px; height: 50px; -webkit-border-radius: 25px; -moz-border-radius: 25px; border-radius: 25px; margin-bottom: 10px; background-color: "black"; } .back{ width: 60px; margin: 10px 0px 10px 20px; padding-left: 10px; padding-top: 10px; padding-bottom: 10px; background-color: black; } body{ margin: 0; }
<div class="back"> <div id="circleRed"> </div> <div id="circleOrange"> </div> <div id="circleGreens"> </div> </div>
相关问答
更多-
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
您可以在loop函数中调用所有setTimeout函数。 并使用setInterval调用此循环函数。 注意:我还更改了代码中的一些颜色更改部分。 jsfiddle链接: https ://jsfiddle.net/zgdx5xan/ var red = document.getElementById("circleRed"); var orange = document.getElementById('circleOrange') var green = document.getElementById ...
-
问题是你的myElement变量是在全局范围内定义的,每次mouseout执行都会覆盖它的前一个值。 如果用var myElement = jQuery(this);定义了myElement var myElement = jQuery(this); , myElement将仅在当前mouseout事件的范围内定义 - 并且仅影响超时回调中的该元素。 The problem is that your myElement variable is defined in the global scope, and ...
-
您可以清除click事件内部的间隔。 var colorInterval; $($li).on('click', function() { clearInterval(colorInterval); colorClick($(this)); }); //Your other code colorInterval = setInterval(function() { //Rest of your code }); You could just clear the interval ins ...
-
您正在使用全局变量$elm 。 在执行超时之前单击按钮时,变量已被覆盖,并且方法( $elm.fadeOut )不再绑定到该元素(因为变量引用了创建的最新元素)。 我的建议是在函数中使用var使其成为本地的: var $elm = $(''); 请参阅更新小提琴 You are using the global variable $elm. When you click the button before the timeout has execut ...
-
只需在另一个回调函数中调用这两个函数 setInterval(function () { functionA(); functionB(); }, 20000); Just call both the functions within another callback function like setInterval(function () { functionA(); functionB(); }, 20000);
-
无论如何实现setTimeout或setInterval,这都是一个非常有效的想法。 如果您将来有N个事件安排在N个不同的时间,请创建一个对象数组,其中每个对象在事件到期时具有属性,并且该属性告诉您它是什么类型的事件(回调或某些事件)其他标识符)。 最初按时间属性对该数组进行排序,以便下一次在事件的前面,最后的时间在最后。 然后,查看数组的前面,计算直到该事件的时间并在该持续时间内执行setTimeout() 。 当setTimeout()触发时,查看数组的开头并处理所有已到达时间的事件。 如果在处理事件之 ...
-
要解决当前问题:在重置按钮的onclick函数中添加clearInterval(window.t) 。 一种能够具有多个定时器的方法。 但这需要一定的结构。 小提琴(6个定时器!): http : //jsfiddle.net/dztGA/27/ (function(){ //Anonymous function, to not leak variables to the global scope var defaultSpeed = 3000; //Used when missing va ...
-
这两个世界的优点怎么样? 您正在按顺序创建Player对象。 因此,它们将以与创建时相同的顺序超时。 记住这一点,你一次只需要一个setTimeout (对于接下来会超时的Player对象)。 这是如何实现它: function Player() { this.enqueue(); } Player.prototype = { queue: [], constructor: Player, enqueue: function () { var length ...
-
编辑:不知怎的,我错过了Igoel的评论,他说同样的话。 对于那个很抱歉。 没有简单的方法来查询超时以查看已经过了多长时间。 您可以将超时的开始时间存储在单独的变量中,然后显式计算差异。 FWIW,请注意,JavaScript超时不一定准确,因为JavaScript是单线程执行环境。 Edited: Somehow I missed Igoel's comment where he says the same thing. Sorry about that. There is no simple way t ...