Dimas Maulana

Dimas Maulana

Developer

Welcome to my website! I am a developer with a current focus on React and Go. My experience encompasses both front-end and back-end development, enabling me to design and develop seamless and efficient applications.

Delve Dlv Not Restart When Update Files on Golang Cosmtrek Air 12710…

If you’re facing issues with Delve (dlv) not restarting when updating files in your Go project using Cosmtrek/Air version 1.27.10 and encountering a “port address already in use” error, there are a couple of solutions you can try. This problem often occurs due to lingering Delve processes that prevent the tool from restarting properly.

Solution 1: Revert to a Previous Version

You can revert to a previous version of Cosmtrek/Air where this issue might not exist. To do this, follow these steps:

REST API Testing Strategy What Exactly Should You Test

API testing is a crucial part of software quality assurance, ensuring that APIs function correctly, securely, and efficiently. This guide details key test actions, test scenario categories, and test flows to ensure a thorough validation of API behavior.

API Test Actions

Each API test involves several key actions:

Bash Script to Get the Directory of the Script File

In Bash scripting, it’s often useful to determine the directory where the script file is located. This can be particularly important if your script needs to access other files or resources relative to its own location. Here’s a Bash script snippet that accomplishes this task:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#!/bin/bash

# Get the directory of the script file
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)

# Check if SCRIPT_DIR is empty or not
if [ -z "$SCRIPT_DIR" ]; then
  echo "Failed to determine the script directory."
  exit 1
fi

# Now, you can use SCRIPT_DIR for your operations
echo "The script is located in the directory: $SCRIPT_DIR"

Here’s a breakdown of what this script does:

Git Repository Naming

This article explores best practices for naming Git repositories, ensuring clarity, consistency, and maintainability. It covers key considerations such as readability, versioning, project scope, and collaboration standards to help developers create effective repository names.

Microservices

Better suited to a project team or department where multiple products exist and are made up of sub-components.

Shell Bash Check if Environment Exist

Your provided code snippet appears to be a Bash script that checks if the TARGET_PATH environment variable is empty and, if so, sets it to ~/go by appending an export statement to the .bashrc file. This is a common technique to ensure that environment variables are set with default values if they are not already defined.

Here’s a breakdown of what the code does:

  1. if [[ -z "${TARGET_PATH}" ]]; then: This line checks if the TARGET_PATH environment variable is empty (i.e., its value is not set). The -z flag is used to test if a string is empty.

Shell Bash Check PATH Environment Exist

It looks like you are trying to check if a specific directory is included in the PATH environment variable in a Bash script. The code you provided is almost correct, but it has a small issue. You can modify it as follows to make it work correctly:

1
2
3
4
5
6
7
CHECK_PATH="/root/go/bin"

if [[ ":$PATH:" == *":$CHECK_PATH:"* ]]; then
    echo "Path found in PATH environment. Skipping configuration..."
else
    echo "Path not found in PATH environment. You may need to add it."
fi

Here’s a breakdown of the changes made:

0%