首页 \ 问答 \ Intellij上的Golang插件。(Golang plugin on Intellij. Library and break points)

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中,它是这样做的:

包的路径

现在,我想要:

  1. 建立我的项目没有警告
  2. 调试我的项目

第一点。 我做了一个“构建”,比我有:“包没有指定”

包未指定

如果我写封装名称main ,那么警告不会消失:

无法找到软件包<code> main </ code>

我可以做什么?


第二点。 大会是成功的。 在我可以调试的那部分包之后,我不能调试另一个包。 例如,我可以调试包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:

Path to packages

Now, I want:

  1. Build my project without warning
  2. Debugging my project

First point. I make a 'build' and than I have: "Package is not specified"

Package is not specified

If I write to Package name main, than warning doesn't disappear:

Cannot find package <code>main</code>

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

Tree of catalog

I cannot set a breaks point in this file:

Break point

Please, help me with my problems.


原文:https://stackoverflow.com/questions/41334268
更新时间:2022-06-06 20:06

最满意答案

您可以在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 a loop function. And call this loop function with setInterval. 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>
 

相关问答

更多
  • 您可以在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 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)