Sublime Text: [Errno 2] No such file or directory: 'gopls' - linux

Installed LSP server on Sublime Text 3, then enabled gopls from the LSP: Enable Language Server Globally > selected gopls.
Also executed below command on terminal.
GO111MODULE=on go get golang.org/x/tools/gopls#latest
Error shown:
LSP.sublime-settings
{
"clients":
{
"gopls":
{
"enabled": true
}
}
}
gopls command
❯ which gopls
/home/user/go/bin/gopls
I am using MX Linux. Please help !
Source

This solved the problem.
## LSP.sublime-settings -- User
{
"clients":
{
"gopls":
{
"command": [
"/home/rahulbali/go/bin/gopls",
"-v",
"-rpc.trace",
"-logfile=/home/rahulbali/gopls.log"
],
"enabled": true,
"env": {
"PATH": "home/rahulbali/go/bin:/usr/local/go/bin"
},
"scopes":["source.go"],
"syntaxes": [
"Packages/Go/Go.sublime-syntax",
"Packages/GoSublime/syntax/GoSublime-Go-Recommended.sublime-syntax",
],
"settings": {
"gopls.usePlaceholders": true,
"gopls.completeUnimported": true,
},
"languageId": "go"
}
}
}
Source: https://github.com/golang/go/issues/43746#issuecomment-761760279
Edit: Make 'gopls' is in your shell path.

What sublime text quotes is:
{
"clients": {
"gopls": {
"enabled": true,
"command": ["gopls"],
"selector": "source.go",
"initializationOptions": {
"experimentalWorkspaceModule": false
}
}
}
}
Giving the absolute path (which gopls) to gopls binary should solve the 'not found' problem.
{
"clients": {
"gopls": {
"enabled": true,
"command": ["/Users/xxx/go/bin/gopls"],
"selector": "source.go",
"initializationOptions": {
"experimentalWorkspaceModule": false
}
}
}
}

Related

Log rotation on IoT Edge Agent

I am following Microsoft documentation and trying to set the logs for edge Agent through the container options. My deployment.template.json file is as follows:
{
"$schema-template": "2.0.0",
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"schemaVersion": "1.0",
"runtime": {
"type": "docker",
"settings": {
"minDockerVersion": "v1.25",
"loggingOptions": "",
"registryCredentials": {
"myRegistryName": {
"username": "$CONTAINER_REGISTRY_USERNAME",
"password": "$CONTAINER_REGISTRY_PASSWORD",
"address": "myRegistryAddress.azurecr.io"
}
}
}
},
"systemModules": {
"edgeAgent": {
"type": "docker",
"settings": {
"image": "mcr.microsoft.com/azureiotedge-agent:1.0",
"createOptions": {
"HostConfig": {
"LogConfig": {
"Type": "json-file",
"Config": {
"max-size": "10m",
"max-file": "3"
}
}
}
}
}
},
"edgeHub": {
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "mcr.microsoft.com/azureiotedge-hub:1.0",
"createOptions": {
"HostConfig": {
"PortBindings": {
"5671/tcp": [
{
"HostPort": "5671"
}
],
"8883/tcp": [
{
"HostPort": "8883"
}
],
"443/tcp": [
{
"HostPort": "443"
}
]
},
"LogConfig": {
"Type": "json-file",
"Config": {
"max-size": "10m",
"max-file": "3"
}
}
}
}
}
}
},
"modules": {
"Module_Name": {
"version": "1.0",
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "${MODULES.Module_Name}",
"createOptions": {
"HostConfig": {
"LogConfig": {
"Type": "json-file",
"Config": {
"max-size": "10m",
"max-file": "3"
}
}
}
}
}
}
}
}
},
"$edgeHub": {
"properties.desired": {
"schemaVersion": "1.0",
"routes": {
"route": "FROM /messages/* INTO $upstream"
},
"storeAndForwardConfiguration": {
"timeToLiveSecs": 7200
}
}
}
}
}
When I build and deploy it on my device, edge Hub and my module log rotation are applied but edgeAgent log rotation is not applied. I check the log rotation settings in the
/var/lib/docker/containers/{container_id}/hostconfig.json file.
What I have done so far:
Removed the image through sudo docker rmi sudo docker rmi mcr.microsoft.com/azureiotedge-agent:1.0 and removed all the containers including the edgeAgent container and restarted the edge environment by sudo systemctl restart iotedge. The log rotation is still not applied to the new container created by the edge run time. I am not sure, what am I missing ? Any help is appreciated. Please note, I don't want to apply log rotation by creating a daemon.json file and placing it in the edge run time folder. I need to do it through the container options specified in the deployment.template.json file.
This is a known bug where edge agent deployment does not apply if version number is identical to the one in config.yaml; please help to create a github issue for it. To workaround, please set the options in config.yaml.

Failed to run Taurus and ChromeDriver (non-headless) on EC2 linux machine

So i'm trying to run a simple test with Taurus and selenium with chrome driver.
ubuntuXXXXXX$ chromedriver --version
ChromeDriver 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72)
ubuntuXXXXXX$ google-chrome --version && which google-chrome
Google Chrome 73.0.3683.103
/usr/bin/google-chrome
error logs:
INFO: Create JUnit 4 request with following arguments: [aws.BookAFlightNew]
Starting ChromeDriver 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72) on port 28517
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1555756176.632][INFO]: [44084fb1ebc5abbc49f588f6d30790a8] COMMAND InitSession {
"capabilities": {
"alwaysMatch": {
"goog:chromeOptions": {
"args": [ ],
"extensions": [ ]
}
},
"desiredCapabilities": {
"browserName": "chrome",
"goog:chromeOptions": {
"args": [ ],
"extensions": [ ]
}
},
"firstMatch": [ {
"browserName": "chrome"
} ],
"requiredCapabilities": {
}
},
"desiredCapabilities": {
"browserName": "chrome",
"goog:chromeOptions": {
"args": [ ],
"extensions": [ ]
}
},
"requiredCapabilities": {
}
}
[1555756176.632][INFO]: Populating Preferences file: {
"alternate_error_pages": {
"enabled": false
},
"autofill": {
"enabled": false
},
"browser": {
"check_default_browser": false
},
"distribution": {
"import_bookmarks": false,
"import_history": false,
"import_search_engine": false,
"make_chrome_default_for_user": false,
"skip_first_run_ui": true
},
"dns_prefetching": {
"enabled": false
},
"profile": {
"content_settings": {
"pattern_pairs": {
"https://*,*": {
"media-stream": {
"audio": "Default",
"video": "Default"
}
}
}
},
"default_content_setting_values": {
"geolocation": 1
},
"default_content_settings": {
"geolocation": 1,
"mouselock": 1,
"notifications": 1,
"popups": 1,
"ppapi-broker": 1
},
"password_manager_enabled": false
},
"safebrowsing": {
"enabled": false
},
"search": {
"suggest_enabled": false
},
"translate": {
"enabled": false
}
}
[1555756176.632][INFO]: Populating Local State file: {
"background_mode": {
"enabled": false
},
"ssl": {
"rev_checking": {
"enabled": false
}
}
}
[1555756176.632][INFO]: Launching chrome: /usr/bin/google-chrome --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-blink-features=ShadowDOMV0 --enable-logging --force-fieldtrials=SiteIsolationExtensions/Control --ignore-certificate-errors --load-extension=/tmp/.com.google.Chrome.gVwWj6/internal --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=0 --test-type=webdriver --use-mock-keychain --user-data-dir=/tmp/.com.google.Chrome.S44UB0 data:,
[1555756176.734][INFO]: [44084fb1ebc5abbc49f588f6d30790a8] RESPONSE InitSession ERROR unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
[1555756176.734][DEBUG]: Log type 'driver' lost 0 entries on destruction
[1555756176.734][DEBUG]: Log type 'browser' lost 0 entries on destruction
when adding to the config file headless chrome view, test is passed.
What do i miss?

"commands" (shortcuts): is it possible to sort them for `chrome://extensions/shortcuts`?

In my manifest.json I have:
"commands": {
"add": {
"suggested_key": {
"default": "MacCtrl+Shift+A"
},
"description": "__MSG_addToFeed__"
},
"playPause": {
"suggested_key": {
"default": "Alt+P"
},
"description": "__MSG_playPause__"
},
"nextArticle": {
"description": "__MSG_nextArticle__"
},
"nextChunk": {
"suggested_key": {
"default": "Alt+N"
},
"description": "__MSG_nextChunk__"
},
"prevArticle": {
"suggested_key": {
"default": "Alt+B"
},
"description": "__MSG_prevArticle__"
}
}
This is what I get on chrome://extensions/shortcuts
I do not understand how they are sorted - neither by title nor by shortcut. And looks like no way to change that order.
Documentation links:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/commands
https://developer.chrome.com/extensions/commands
Related source code of Chromium: https://github.com/chromium/chromium/blob/2ca8c5037021c9d2ecc00b787d58a31ed8fc8bcb/chrome/browser/resources/md_extensions/keyboard_shortcuts.js
Add numbers to your commands object as they are sorted by their keys.
"commands": {
"1_add": { ... },
"2_playPause": { ... },
"3_nextArticle": { ... },
"4_nextChunk": { ... },
"5_prevArticle": { ... }
}

CloudFormation how to export a variable

The following is a part of our template. We export a path variable there. However, running from template, this does not work. If I SSH into the server and run the same line, it works and I can use gradle. But just from the template, it somehow doesn't get executed. The other chmod commands work, so the block is clearly execute. Any help is highly appreciated.
...
"LaunchConfiguration": {
"Type": "AWS::AutoScaling::LaunchConfiguration",
"Metadata": {
"AWS::CloudFormation::Init": {
"config": {
"packages": {
"yum": {
"java-1.8.0-openjdk-devel": []
}
},
"sources": {
"/opt": "https://services.gradle.org/distributions/gradle-3.4.1-bin.zip",
"/home/ec2-user": "https://github.com/ABC/XYZ/archive/master.zip"
},
"files": {
"/tmp/gradle_config": {
"content": {
"Fn::Join": ["",
[
"#!/bin/bash -ex\n",
"chmod -R 755 gradle-3.4.1/\n",
"export PATH=$PATH:/opt/gradle-3.4.1/bin\n" //<<<< This does not work
]
]
},
"mode": "000500",
"owner": "root",
"group": "root"
},
"/tmp/app_config": {
"content": {
"Fn::Join": ["",
[
"#!/bin/bash -ex\n",
"chmod -R 777 XYZ-master/\n"
]
]
},
"mode": "000500",
"owner": "root",
"group": "root"
}
},
"commands": {
"01_config": {
"command": "/tmp/gradle_config",
"cwd" : "/opt"
},
"02_config": {
"command": "/tmp/app_config",
"cwd" : "/home/ec2-user"
}
}
}
}
}, ...
I found the solution. All those lines are executed as root user. The export PATH... therefore wasn't for my ec2-user. The way I handled is was by putting the path variable (globally) into the /etc/environment file.
In my code snippet, just replace
"export PATH=$PATH:/opt/gradle-3.4.1/bin\n",
with
"echo \"PATH=$PATH:/opt/gradle-3.4.1/bin\" >> /etc/environment"",

Visual Studio Test Explorer does not discover jasmine tests

I have jasmine tests that run through the Chutzpah context menu extension (Run JS tests). However they do not get discovered by the Test Explorer and when I right-click and select Run Tests, the output from "Tests" gives me this:
System.ArgumentException: The directory name is invalid.
at System.IO.FileSystemWatcher..ctor(String path, String filter)
at Chutzpah.VS11.EventWatchers.TestFilesUpdateWatcher.AddWatch(String path)
at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.UpdateTestContainersAndFileWatchers(IEnumerable`1 files, Boolean isAdd)
at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.GetTestContainers()
at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.get_TestContainers()
at Microsoft.VisualStudio.TestWindow.Controller.TestContainerDiscovererExtension.GetSortedContainers(ITestContainerDiscoverer discoverer)
at Microsoft.VisualStudio.TestWindow.Controller.TestContainerProvider.GetContainersFromDiscoverer(ITestContainerDiscoverer discoverer)
No tests found to run.
Here's my chutzpah.json file also:
{
"Framework": "jasmine",
"FrameworkVersion": "2",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"References": [
{ "Path": "../../DIB.MemberCatalog/lib/dust/dust-full.js" },
{ "Path": "../../DIB.MemberCatalog/lib/dust-helpers/dust-helpers.js" },
{ "Path": "../../DIB.MemberCatalog/lib/harvey/harvey.js" },
{ "Path": "../../DIB.MemberCatalog/lib/hopscotch/js/hopscotch.js" },
{ "Path": "../../DIB.MemberCatalog/lib/jquery/jquery-1.11.1.js" },
{ "Path": "../../DIB.MemberCatalog/lib/jquery-ui/jquery-ui.js" },
{ "Path": "../../DIB.MemberCatalog/lib/jquery-validate/jquery.validate.js" },
{ "Path": "../../DIB.MemberCatalog/lib/knockout/knockout-3.1.0.js" },
{ "Path": "../../DIB.MemberCatalog/lib/knockout-mapping/knockout.mapping.js" },
{ "Path": "../../DIB.MemberCatalog/lib/knockout-validation/knockout.validation.js" },
{ "Path": "../../DIB.MemberCatalog/lib/lightbox/js/lightbox.js" },
{ "Path": "../../DIB.MemberCatalog/lib/respond/respond.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/jquery.qtip.min.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/json2.min.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/jquery.cookie.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/jquery.hoverIntent.min.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/jquery.lazyload.min.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/changecheck.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/stickytable.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/superalert.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/core.js" },
{ "Path": "prepare.js" },
{ "Path": "engine.js" }
],
"Tests": [
{ "Path": "tests" }
],
"CodeCoverageIncludes": [],
"CodeCoverageExcludes": []
}
Solution structure:
DIB.MemberCatalog
-Testing
- DIB.MemberCatalog.Tests.JS
- data
- lib
- jasmine-2.0.0
- (jasmine files, boot, console, jasmine)
- tests
- testfiles.js
- chutzpah.json
-DIB.MemberCatalog
- (more...)
I've scoured the internet and can't find a solution.
Solved by changing my test project name from DIB.MemberCatalog.Tests.JS to DIB.MemberCatalog.Tests.Client. Confusion happens when the project has the javascript file extension at the end of the project name.

Resources